I'm trying to remove all users that are unlicensed from the global address list.
So far, I've found that ...
$mboxes = Get-MsolUser -All -UnlicensedUsersOnly
... will get me all unlicensed users, and put them in a variable called $mboxes, however there doesn't appear to be an Identity here.
For when I try and run something like:
foreach ($mbox in $mboxes) { Set-Mailbox -HiddenFromAddressListsEnabled $true -Identity $mbox }
I get back the following error.
Cannot process argument transformation on parameter 'Identity'.
I've tried exporting that data to a CSV and creating an "Identity" header, however I get the same issue after re-importing the data back into PowerShell.