Powershell – Exchange – enable/disable junk mail rule in a mailbox

Set-MailboxJunkEmailConfiguration -Enabled <$true | $false>

To check:

Get-MailboxJunkEmailConfiguration

To disable the junk email rule on all mailboxes in Exchange:

$All = Get-Mailbox -RecipientTypeDetails UserMailbox -ResultSize Unlimited
$All | foreach {
Set-MailboxJunkEmailConfiguration $_.Name -Enabled $false
}

Exchange 2013 and 2016 Server maintenance

I have a two node DAG with the servers ex01 and ex02. I will be putting ex01 into maintenance mode:
1. Launch Exchange Management Shell
2. Use the Set-ServerComponentState command to set the HubTransport component into a draining state
3. Set-ServerComponentState ex01 –Component HubTransport –State Draining –Requestor Maintenance
4. Use the Redirect-Message command to redirect messages currently in the queue – You may get an error message here.
5. Redirect-Message –Server ex01 –Target ex02
6. Use the Suspend-ClusterNode command to pause ex01 from participating in the cluster
7. Suspend-ClusterNode –Name ex01
8. Disable the database copy auto-activation on ex01
9. Set-MailboxServer ex01 –DatabaseCopyActivationDisabledAndMoveNow $true
10. Set DatabaseCopyAutoActivationPolicy to blocked
11. Set-MailboxServer ex01 –DatabaseCopyAutoActivationPolicy Blocked
12. Confirm that there are no Databases mounted on ex01. The command below should return no results.
13. Get-MailboxDatabaseCopyStatus –Server ex01 | Where {$_.Status –eq “Mounted”}
14. If mailboxes are still on ex01 move them to ex02.
15. Move-ActiveMailboxDatabase DB1 -ActivateOnServer ex02
16. Now place the server in Maintenance Mode
17. Set-ServerComponentState ex01 –Component ServerWideOffline –State InActive –Requestor Maintenance

At this point I can perform my maintenance on ex01 (i.e Windows/Exchange updates etc.).
And here are the steps below to bring it back into the cluster.
1. Take ex01 out of maintenance mode
2. Set-ServerComponentState ex01 –Component ServerWideOffline –State Active –Requestor Maintenance
3. Resume cluster operations on ex01
4. Resume-ClusterNode –Name ex01
5. Set Database Copy Auto Activation Policy to Unrestricted
6. Set-MailboxServer ex01 –DatabaseCopyAutoActivationPolicy Unrestricted
7. Set Database Copy Activation Disabled and Move to FALSE
8. Set-MailboxServer ex01 –DatabaseCopyActivationDisabledAndMoveNow $false
9. Set the Hub Transport component to Active
10. Set-ServerComponentState ex01 –Component HubTransport –State Active –Requester Maintenance

JOB DONE

PS Exchange – Contacts

get-mailcontact

Name                      Alias                                          RecipientType
----                      -----                                          -------------
Sam K. Tobias             stobias                                        MailContact


New-MailContact -FirstName "Jenny" -LastName "Cobolt" -Name "Jenny Cobolt" -ExternalEmailAddress jc@cobo
lt.com

Name                      Alias                                          RecipientType
----                      -----                                          -------------
Jenny Cobolt              JennyCobolt                                    MailContact


get-mailcontact

Name                      Alias                                          RecipientType
----                      -----                                          -------------
Sam K. Tobias             stobias                                        MailContact
Jenny Cobolt              JennyCobolt                                    MailContact

PS Exchange – Room Mailboxes

get-mailbox | where {$_.ResourceType -eq "Room" }

Name                      Alias                ServerName       ProhibitSendQuota
----                      -----                ----------       -----------------
Executive  Conference ... NYConfRoom           exchange01       Unlimited


New-Mailbox -Database DB01 -Name "ConferenceRoomMadrid" -DisplayName "Conference Room - Madrid" -Room

Name                      Alias                ServerName       ProhibitSendQuota
----                      -----                ----------       -----------------
ConferenceRoomMadrid      ConferenceRoomMadrid exchange01       Unlimited


get-mailbox | where {$_.ResourceType -eq "Room" }

Name                      Alias                ServerName       ProhibitSendQuota
----                      -----                ----------       -----------------
Executive  Conference ... NYConfRoom           exchange01       Unlimited
ConferenceRoomMadrid      ConferenceRoomMadrid exchange01       Unlimited