Hi Guys,
I have designed a below script and its getting the information what it suppose to get but there is one problem and that is if the user who's user principal name is different to domain login name than its not getting the Full mailbox access name in the report any idea why although when I look via GUI I can see that member with the same domain name like the other user which I get the name in the report.
For eg
User principal name
User1 @domain1.com
user login name pre windows 2000
Domain\user1
User principal name
User2 @domain.com
user login name pre windows 2000
Domain\user2
User two information is coming in the report but user 1 name is not coming in the report and I am confused why? Please help
$OutFile = "D:\Ali\PermissionExport.txt"
"DisplayName" + "^" + "Alias" + "^" + "Full Access" + "^" + "Send As" | Out-File $OutFile -Force
$Mailboxes = Get-Mailbox -organizationalUnit "Domain.local/User" | Select DisplayName, Identity, Alias, DistinguishedName
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 | Where { ($_.AccessRights -eq "FullAccess") -and ($_.IsInherited -eq $false) -and ($_.User -notlike "NT AUTHORITY\SELF")} | % {$_.User}
$Mailbox.DisplayName + "^" + $Mailbox.Alias + "^" + $FullAccess + "^" + $SendAs | Out-File $OutFile -Append
}
Ali Hussaini