$ users.user.rawidentity eliminará a conversão de tipos e mais algumas linhas ...
lista "Acesso total"
$users=Get-Mailbox ap.cz | Get-MailboxPermission | where {$_.user.tostring() -ne "NT AUTHORITY\SELF" -and $_.IsInherited -eq $false}
$ss=$users.user.rawidentity | Where-Object {$_ -notlike "s-1*"}
foreach ($item in $ss){
$b = $item.Split("\")
$c=$b.Split("}")[1]
Get-ADUser -identity $c -properties DisplayName | select DisplayName
}
lista "Enviar como"
$users=Get-Mailbox ap.cz | Get-ADPermission | where { ($_.ExtendedRights -like “*Send-As*”) -and ($_.IsInherited -eq $false) -and -not ($_.User -like “NT AUTHORITY\SELF”) } | Select User
$ss=$users.user.rawidentity | Where-Object {$_ -notlike "s-1*"}
foreach ($item in $ss){
$b = $item.Split("\")
$c=$b.Split("}")[1]
Get-ADUser -identity $c -properties DisplayName | select DisplayName
}