Exchange Groups are one of the most popular features in Exchange Server. Administrators delegate users the SendAs permission to the users to send emails using the group name and email address instead of their corporate account name.
I wrote a PowerShell script to list all these permission for both Exchange Online and Exchange on-premise.
Table of Contents
Download the Exchange SendAS Script Reporter
You can download the PowerShell script from my GitHub repo here
Prerequisites
- The Script needs to get a list of distribution groups for Exchange Online
- The Script needs to get a list of distribution group for Exchange on-premise and also read Group permission (Get-ADPermission – Get-DistributionGroup)
- PowerShell 5.1 or 7
How to use the Exchange Sendas
The script accepts the following parameters:
- [Switch] ReportAll: This parameter generates an HTML report for all Exchange Online and on-premise distribution groups SendAs and SendOnBehalf permission. This report contains the following fields:
- OnPremGroupName: Name of the distribution group.
- OnPremSendOnBehalf: Users with GrantSendOnBehalf permission (On-premise).
- OnPremSendAs: Users with SendAs Permission on the distribution group (On-premise).
- IsSyncedGroup: The group is synced to Exchange Online or not
- OnCloudSendAs: Users with SendAs permission on Exchange Online distribution group.
- OnCloudSendOnBehalf: Users with GrantSendOnBehalf permission on Exchange Online distribution group.
- [Switch] OnPremOnly: This parameter generates an HTML report for all on-premise only distribution groups SendAs and SendOnbehalf. The report contains the following fields:
- OnPremGroupName: Name of the distribution group
- OnPremSendOnBehalf: Users with GrantSendOnBehalf permission (On-premise).
- OnPremSendAs: Users with SendAs Permission on the distribution group (On-premise).
- [Switch] CloudOnly: This parameter generates an HTML report for Exchange Online distribution groups SendAs and SendOnbehalf. The report contains the following fields:
- GroupName: Name of the distribution group
- OnCloudSendAs: Users with SendAs permission on Exchange Online distribution group.
- OnCloudSendOnBehalf: Users with GrantSendOnBehalf permission on Exchange Online distribution group.
- [String] OnPremExchangeServer: The Local Exchange Server FQDN myserver.mydomain.local
- [validateset] Auth: The authentication method to use, Kerberos, Basic, Default
When using CloudOnly parameter, there is no need to set any additional parameter
Examples on using the script
Using the –ReportAll parameter:
.\Get-SendAsReport.ps1 -ReportAll -OnPremExchangeServer mylocal.server.local -Auth Default
Using the -CloudOnly Parameter:
.\Get-SendAsReport.ps1 -CloudOnly
Using the -OnPremOnly Parameter:
.\Get-SendAsReport.ps1 -OnPremOnly -OnPremExchangeServer mylocal.server.local -Auth Default
The report will be similar to -CloudOnly parameter but the output are related to on-premise server.
Related Posts
Clean Exchange Server Services Logs and Free a lot of space easily
Enable Exchange Maintenance Mode On/Off with easily Using EMM PowerShell module
Thank you for the script. I am experiencing an issue when using the -OnPremOnly switch.The error is “A parameter cannot be found that matches parameter name ‘OnPremOnly'”. The script does work using the -OnPremisesOnly switch, but I no output is regenerated.
Would you please tell me the full cmdlet and parameter you used
Here is the syntax I used.
PS C:\windows\system32> C:\DATA\WORK\Powershell\Get-SendAsReportv1.ps1 -OnPremOnly -OnPremExchangeServer exchange.somedomain.local -Auth Default
C:\DATA\WORK\Powershell\Get-SendAsReportv1.ps1 : A parameter cannot be found that matches parameter name ‘OnPremOnly’.
At line:1 char:48
+ C:\DATA\WORK\Powershell\Get-SendAsReportv1.ps1 -OnPremOnly -OnPremExc …
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-SendAsReportv1.ps1], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Get-SendAsReportv1.ps1