如何扩展
$thisPerms = Get-Mailbox username -ResultSize unlimited
Get-ADPermission $thisPerms.Identity
| Where {$_.ExtendedRights -like "Send-As" -and $_.User.ToString() -ne "NT AUTHORITY\SELF" -and $_.Deny -eq $false}
| select user, ExtendedRights, identity, isinherited -ExpandProperty ExtendedRights
| Export-Csv c:\out.csv\]
输出到屏幕
User ExtendedRights Identity IsInherited
---- -------------- -------- -----------
domain\user {Send-As} company.com/Division/Corporate... False
输出到文本文件
注意如何呈现 ExtendedRightIdParameter 而不是 SendAs 权限
#TYPE Microsoft.Exchange.Configuration.Tasks.ExtendedRightIdParameter
"User","ExtendedRights","Identity","IsInherited"
company\user","Microsoft.Exchange.Configuration.Tasks.ExtendedRightIdParameter[]","company.com/Division/Corporate Services/User","False"
如何让 CSV 包含 ExpandProperty 的输出?
答案1
看起来您需要将 ExtendedRights 属性转换为字符串..要做到这一点..使用 ToString 方法
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
ExtendedRights NoteProperty ExtendedRights=null