update
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
#Requires -Version 3.0
|
||||
|
||||
param([string]$User)
|
||||
|
||||
## Install ExchangeOnlineManagement module if it doesn't already exist
|
||||
If ( !(Get-Module -ListAvailable -Name ExchangeOnlineManagement) )
|
||||
{
|
||||
Try { Install-Module -Name ExchangeOnlineManagement -RequiredVersion 1.0.1 }
|
||||
Catch { Write-Output $_.Exception.Message ; Exit }
|
||||
}
|
||||
Import-Module ExchangeOnlineManagement
|
||||
|
||||
Connect-ExchangeOnline -UserPrincipalName $User -ShowProgress $true
|
||||
|
||||
|
||||
$Groups = Get-UnifiedGroup -ResultSize Unlimited
|
||||
$Groups | ForEach-Object {
|
||||
$group = Get-UnifiedGroupLinks -Identity $_.Name -LinkType Members -ResultSize Unlimited
|
||||
$group | ForEach-Object {
|
||||
New-Object -TypeName PSObject -Property @{
|
||||
Group = $group.DisplayName
|
||||
Member = $_.Name
|
||||
EmailAddress = $_.PrimarySMTPAddress
|
||||
RecipientType= $_.RecipientType
|
||||
}
|
||||
}
|
||||
} | Export-CSV “${Env:UserProfile}\Desktop\group-export.csv" -NoTypeInformation -Encoding UTF8
|
||||
|
||||
|
||||
|
||||
|
||||
Disconnect-ExchangeOnline
|
||||
Reference in New Issue
Block a user