Powershellscript listing all security groups a Office 365 is in.

The CMD's for managing users on Office 365 is very limited.

I want a simple list of groups a specific msoluser is member of.

How can I achive this?

I guess I'll have to use a combination of get-msoluser, get-msolgroup and get-msolgroupmember?

September 2nd, 2015 7:40am

For specific user username@yourdomain.com

Connect-MsolService
$UserEmailAddress = "username@yourdomain.com"
$Groups = Get-MsolGroup -All
foreach ($Group in $Groups) {
$GroupID = $Group.objectid
$GroupName = $Group.DisplayName
Get-MsolGroupMember -GroupObjectId $GroupID | where {$_.emailaddress -like $UserEmailAddress} | select @{Name="Group"; Expr={$GroupName}},EmailAddress
}

Free Windows Admin Tool Kit Click here and download it now
September 2nd, 2015 9:29am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics