Script for Exporting Shared Mailboxes Send-As users as a Primary SMTP Address for Exchange Server 2016
Syed Sabih Haider
MCT | Solution Specialist Modern Workplace @ Hitachi Energy | Leading fight against cybercrime and trying to make a digital world more secure and accessible
You can use the following Script for printing shared mailboxes and the mailboxes which could send as it is :
$Mailboxes = Get-Mailbox -RecipientTypeDetails SharedMailbox -ResultSize Unlimited ForEach ($Mailbox in $Mailboxes){ $users = Get-ADPermission $Mailbox.DistinguishedName | ? {$_.ExtendedRights -like "Send-As" -and $_.User -notlike "NT AUTHORITY\SELF" -and !$_.IsInherited} | % {$_.User} foreach($user in $users){ $SendAs = Get-Mailbox $user.tostring() | % {$_.PrimarySmtpAddress} Write-Host($Mailbox,$SendAs) }
}
Now output would be like given in the screenshot:
Thanks for reading my article!! Stay tuned for more