Microsoft Exchange Server provides a powerful command-line interface through its Exchange Management Shell, allowing administrators to manage various server operations efficiently. Whether you’re performing maintenance, moving databases, or changing mailbox types, Exchange Shell commands can help automate and streamline your tasks. Below are some essential Exchange Shell commands that will come in handy for maintaining your servers and managing mailboxes.
Managing Maintenance Mode
Find Out if a Server is in Maintenance Mode
Use this command to check if a server is in maintenance mode:
Get-ServerComponentState -Identity "YourServerName"
Put a Server in Maintenance Mode
Set-MailboxServer “YourServerName” -DatabaseCopyActivationDisabledAndMoveNow $true
Set-ServerComponentState “YourServerName” -Component ServerWideOffline -State Inactive -Requester Maintenance
Get-ServerComponentState -Identity “YourServerName”
Turn Off Maintenance Mode
Set-ServerComponentState "YourServerName" -Component ServerWideOffline -State Active -Requester Maintenance
If Server is Still in Maintenance Mode, Check Who Requested It
(Get-ServerComponentState -Identity <ServerName> -Component <Component>).LocalStates
Managing Mailboxes
Convert User Mailbox to Shared Mailbox
Set-Mailbox -Identity "User Name" -Type Shared
Convert Shared Mailbox to User Mailbox
Set-Mailbox -Identity "Mailbox Name" -Type Regular
Moving Log Path
Change the log file path for an Exchange database
Move-DatabasePath "DB2019" -LogFolderPath "E:\DB2019"
By mastering these Exchange Management Shell commands, you’ll be able to streamline your maintenance tasks, manage mailboxes more efficiently, and ensure your server environment runs smoothly.
Tired of MS Exchange? Here is an article about MailCow and the difference between them.
