導出單一的通錄組到一個TXT文件裡。
Get-DistributionGroupMember | ft name, primarysmtpaddress >> C:\members.txt
請問!
如何導出『所有』的通錄組到一個TXT文件裡?
由於Exhange server剛升級至2016.Exchange的群組較Active Directory少。
建立一個 ListMembers.ps1,內容如下:
執行後產出檔案C:\ListMembers.txt
$saveto = "C:\\ListMembers.txt"
Get-DistributionGroup | sort name | ForEach-Object {
"`r`n$($_.Name)`r`n=============" | Add-Content $saveto
Get-DistributionGroupMember $_ | sort Name | ForEach-Object {
If($_.RecipientType -eq "UserMailbox")
{
$_.Name + " (" + $_.PrimarySMTPAddress + ")" | Add-Content $saveto
}
}
}
已實測在 Exchange 2010 可行.
參考自:
https://community.spiceworks.com/scripts/show/1388-export-distribution-list-members
run with power shell.
然後很快地就自動關掉了
你要用 Exchange EMS 去跑才行, 光叫 PowerShell 她不會載入 Exchange 模組...
如同 raytracy前輩所言,
EMS位於:開始->所有程式->Microsoft Exchange Server xxxx->Exchange Management Shell