# Connect Office 365
Connect-MsolService
# Get all users
$users = get-msoluser -all
# Create array
$upnlist=@()
foreach ($i in $users)
{
$s = $i.UserPrincipalName.tostring()
$upn = $S.substring($s.IndexOf("@"))
$upnlist+=$upn
}
# Output
$upnlist | Group-Object
No comments:
Post a Comment