forked from martinagrom/Ignite-PowerShell-Masterclass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
1-GroupsEssentials.ps1
21 lines (16 loc) · 968 Bytes
/
1-GroupsEssentials.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#---------------------------------------------------------------------------------------
# 1-GroupsEssentials.ps1 - list Office 365 groups
# Microsoft Teams and Office 365 Groups PowerShell Masterclass - by @magrom and @atwork
#---------------------------------------------------------------------------------------
# Get all groups or a specific group
Get-UnifiedGroup | ? {$_.DisplayName -eq 'Ignite'}
# List all groups in descending order
Get-UnifiedGroup | Select Id, DisplayName, ManagedBy, Alias, AccessType, `
WhenCreated, @{Expression={([array](Get-UnifiedGroupLinks -Identity $_.Id -LinkType `
Members)).Count }; Label='Members'} `
| Sort-Object whencreated `
| Format-Table displayname, alias, managedby, Members, accesstype, whencreated
# List all private groups
Get-UnifiedGroup | Where-Object {$_.AccessType -eq 'Private'} | `
Sort-Object whencreated | Format-Table displayname, alias, `
managedby, accesstype, whencreated