Microsoft Exchange Server 2016 shell commands that can be good to know

List all mailbox databases in the organisation

List all mailbox databases with paths
Get-MailboxDatabase | fl Name,EdbFilePath,LogFolderPath

List all mailbox databases with informations about them
Get-MailboxDatabase -status | fl *

Show mailbox databases and the backup status
Get-MailboxDatabase -status | ft server,name,LastFullBackup,LastIncrementalBackup,DatabaseSize

Change name of a mailbox database
Set-MailboxDatabase “Mailbox Database 1721414988” -Name “DB02”

Change database and log ptah of a mailbox database
Move-DatabasePath DB02 -EdbFilePath M:\DB02\DB02.edb -LogFolderPath N:\DB02

Change the queue and queue log path
Create the directories, example:

  • mkdir “Q:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data\Queue”
  • mkdir “R:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data\Queue”

Give “Network service” full control of this directories.
Open the file %ExchangeInstallPath%Bin\EdgeTransport.exe.config in notepad
Change the paths on the rows looks like below

  • <add key=”QueueDatabasePath” value=”Q:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data\Queue” />
  • <add key=”QueueDatabaseLoggingPath” value=”R:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data\Queue” />

After this changes you need to restart the transport service

Move system mailboxes to a new mailbox database
Get-Mailbox -Arbitration | New-MoveRequest -TargetDatabase DB02

Clean up completed move requests
Get-MoveRequest -MoveStatus Completed | Remove-MoveRequest

Show all e-mail accounts/recipients with e-mail addresses
Get-Recipient | Select Name, EmailAddresses

Show all mailboxes in a mailbox database
Get-Mailbox -Database “Mailbox Database”

Show the mail queue

Leave a Reply

Your email address will not be published. Required fields are marked *