powershell
8 TopicsSample Powershell to identify groups with HBI classification and have external users
Here's some sample PowerShell that will - Identify Office 365 Groups with a "HBI" classification and if there are Guest users within the group. - Identify the owners of the respective groups - Identify the specific guest users within each group This could be used in conjunction with Microsoft Flow to programmatically - automate the removal of guest users from groups with specific classifications - automate an email to the owners of the group to alert the presence of external (guest) users in an Office 365 Group - automate an email to the owners of the group to indicate the Office 365 Group is not compliant with guest access policy and then programmatically disable/remove external guests $Groups = Get-UnifiedGroup -Filter {GroupExternalMemberCount -gt 0} | Where-Object {$_.Classification -eq 'HBI'} $groups| Format-Table -AutoSize DisplayName, Classification, GroupMemberCount, GroupExternalMemberCount, Managedby ForEach ($G in $Groups) { $Ext = Get-UnifiedGroupLinks -Identity $G.Identity -LinkType Members ForEach ($E in $Ext) { If ($E.Name -match "#EXT#") { Write-Host "Group " $G.DisplayName "includes guest user" $E.Name } } }1.5KViews2likes0Commentsdynamic group based on assigned license
Hi, is it possible to create a group with users based on a assigned license? So i want to include all users into this specific group who has e.g. an E3 license assigned, but not an E5. It seems, that the only way is to use the a ServicePlan name, not a SKU name, isn't it? Even better would be a dynamic membership rule based on the SKU, not on a ServicePlan. What i tried to do: 1. Get-MsolAccountSKU to find out the SKU name 2. Created a dynamic group without knowing which syntax to use :D 3. Used this dynamic membership rule as a workaround: (user.assignedPlans -any ((assignedPlan.service -match "NAME") -and (assignedPlan.capabilityStatus -eq "Enabled"))) (I found the ServicePlan names via Get-MsolAccountSku | Where-Object {$_.SkuPartNumber -eq “ENTERPRISEPREMIUM”} | ForEach-Object {$_.ServiceStatus} Thank you ina advance. Patrick :)173KViews1like29Comments