Forum Discussion
TomWechsler
Jan 21, 2021MVP
A few PowerShell (Exchange 2019) impressions summarized!
Hi Exchange Friends,
In this article I have summarized a few tasks that I used on a project. This is certainly not an exhaustive summary when it comes to working with Exchange, I just wanted to summarize a few points. Please start with the following steps to begin the "journey" (the Hashtags are comments):
#Please start the EMS (Exchange Management Shell)
#Get infos about messaging tracking log settings
Get-TransportService ex01 | Format-List *tracking*
#We could configure the Exchange organization to send copies of NDRs to the Exchange recipient. Is there a dedicated mailbox for the Exchange recipient?
Get-OrganizationConfig | Select-Object MicrosoftExchangeRecipientReplyRecipient
#To do so, this example assigns the existing mailbox named "Contoso System Mailbox" to the Exchange recipient
Set-OrganizationConfig -MicrosoftExchangeRecipientReplyRecipient "Contoso System Mailbox"
#OAuth2ClientProfileEnabled?
Get-OrganizationConfig | Select-Object OAuth2ClientProfileEnabled
#Are there any retention hold enabled?
Get-Mailbox -ResultSize unlimited | Where-Object {$_.RetentionHoldEnabled -eq $true} | Format-Table Name,RetentionPolicy,RetentionHoldEnabled -Auto
#Did Jane receive an email from the admin?
$Temp = Search-MessageTrackingReport -Identity "exadmin" -Recipients "janeford@contosotom.ch"
Get-MessageTrackingReport -Identity $Temp.MessageTrackingReportID -ReportTemplate Summary
#Infos about content filtering
Get-ContentFilterConfig
#Do we have an Active Sync Rule?
Get-ActiveSyncDeviceAccessRule
#Infos about a specific mailbox
Get-Mailbox -Identity "exadmin" | Format-List *
#If you need to test the internal mailflow
Test-Mailflow -TargetEmailAddress exadmin@contosotom.ch
#A list of distribution groups
Get-DistributionGroup
#A bit more specific
Get-DistributionGroup -Identity IT | Select-Object AcceptMessagesOnlyFrom, AcceptMessagesOnlyFromDLMembers
#Find the permissions required to run a cmdlet
$Perms = Get-ManagementRole -Cmdlet Set-Mailbox
$Perms | ForEach-Object {Get-ManagementRoleAssignment -Role $_.Name -Delegating $false | Format-Table -Auto Role,RoleAssigneeType,RoleAssigneeName}
#Need help?
Get-Help Set-CASMailbox -Full
I am absolutely aware that this is nothing spectacular. I just wanted to share a few impressions with you.
I hope this article was useful. Best regards, Tom Wechsler
P.S. All scripts (#PowerShell, Azure CLI, #Terraform, #ARM) that I use can be found on github! https://github.com/tomwechsler
1 Reply
- shane1670Copper Contributor
TomWechsler the command Set-OrganizationConfig -MicrosoftExchangeRecipientReplyRecipient "Contoso System Mailbox" should work on exchange online. yet I'm getting command not found. What is wrong?