如何扩展
$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的输出?
它看起来像你需要将ExtendedRights属性转换为string..执行此操作..使用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