An administrator wanted to get a list of users who have Send on Behalf permission on mailboxes.
You can get a list of all mailboxes and the users assigned send on behalf permissions using this cmdlet, which creates a CSV file with the accounts assigned send on behalf permissions in a semicolon separated list.
Get-Mailbox | where {$_.GrantSendOnBehalfTo -ne $null} | select Name,Alias,UserPrincipalName,PrimarySmtpAddress,@{l='SendOnBehalfOf';e={$_.GrantSendOnBehalfTo -join ";"}} | Export-CSV "D:\SendOnBehalf.csv"
To view all mailboxes with send as permission assigned in the PowerShell window, use this:
Get-Mailbox | where {$_.GrantSendOnBehalfTo -ne $null} | select Name,Alias,PrimarySmtpAddress,GrantSendOnBehalfTo
To see who has send on behalf permissions on a specific mailbox, use this cmdlet, replacing mailbox-alias with their alias or email address.
Get-Mailbox mailbox-alias | select Name,Alias,UserPrincipalName,PrimarySmtpAddress,@{l='SendOnBehalfOf';e={$_.GrantSendOnBehalfTo -join ";"}} | Export-CSV "D:\SendOnBehalf.csv"
To display the results in the PowerShell window, use
Get-Mailbox mailbox-alias | where {$_.GrantSendOnBehalfTo -ne $null} | select Name,Alias,PrimarySmtpAddress,GrantSendOnBehalfTo
HI!
I think there is some unnecessary cmdlet left in the following code of yours (i bolded them):
1. Get-Mailbox mailbox-alias | select Name,Alias,UserPrincipalName,PrimarySmtpAddress,@{l='SendOnBehalfOf';e={$_.GrantSendOnBehalfTo -join ";"}} | Export-CSV "D:\SendOnBehalf.csv"
2. Get-Mailbox mailbox-alias | where {$_.GrantSendOnBehalfTo -ne $null} | select Name,Alias,PrimarySmtpAddress,GrantSendOnBehalfTo
"To see who has send on behalf permissions on a specific mailbox, use this cmdlet, replacing mailbox-alias with their alias or email address"
"replacing mailbox-alias with their alias or email address" is very clearly mentioned before those scripts