我使用的是Exchange 2010,而我的域只有Windows 2003 DC的
我需要一个Powershell脚本,列出csv文件中某个交换数据库的所有(组)邮箱,并为每个邮箱提供以下信息:
我已经编写了一个小程序,这是一个良好的开端,但我不能让我的成员用户在他们的主SMTP地址上表达:
以下是示例:
$OutFile = "<Certain path>\<filename>_" + $(Get-Date -Format 'dd_MM_yyyy HH_mm tt') + ".csv"
"DisplayName" + "," + "EmailAddresses" + "," + "Full Access" + "," + "Send As" + "," + "ReadPermission" | Out-File $OutFile -Force
$Mailboxes = Get-Mailbox -Database "<Certain Database>" -ResultSize "Unlimited" | Select DistinguishedName, Identity, DisplayName, EmailAddresses
ForEach ($Mailbox in $Mailboxes) {
$SendAs = Get-ADPermission $Mailbox.DistinguishedName | ? {$_.ExtendedRights -like "Send-As" -and $_.User -notlike "NT AUTHORITY\Self" -and !$_.IsInherited} | % {$_.User}
$FullAccess = Get-MailboxPermission $Mailbox.Identity | ? {$_.AccessRights -eq "FullAccess" -and !$_.IsInherited} | % {$_.User}
$ReadPermission = Get-MailboxPermission $Mailbox.Identity | ? {$_.AccessRights -eq "ReadPermission" -and !$_.IsInherited} | % {$_.User}
$Mailbox.DisplayName + "," + $Mailbox.EmailAddresses + "," + $FullAccess + "," + $SendAs + "," + $ReadPermission | Out-File $OutFile -Append
}
有人可以帮助我找到所要求的结果,还是有人有另一个脚本也可以这样做?
由于
答案 0 :(得分:0)
首先重写您创建PS Custom对象所需的内容,然后使用export-csv从这些对象创建输出文件。