Common Exchange Server Powershell commands

To see each database size:

Get-MailboxDatabase -Status | select ServerName, Name, DatabaseSize

Exchange 2010 mailbox size list in particular database:

Get-MailboxDatabase “<insert database name>” | Get-MailboxStatistics | Sort totalitemsize -desc | ft displayname, totalitemsize, itemcount

White Space (AvailableNewMailboxSpace) check with PowerShell:

Get-MailboxDatabase -Status | select Name, DatabaseSize, AvailableNewMailboxSpace

This example permanently deletes the soft-deleted mailbox for Ayla from mailbox database MBD01.

Remove-StoreMailbox -Database MBD01 -Identity Ayla -MailboxState SoftDeleted

This example permanently deletes all soft-deleted mailboxes from mailbox database MBD01.

Get-MailboxStatistics -Database MBD01 | where {$_.DisconnectReason -eq “SoftDeleted”} | foreach {Remove-StoreMailbox -Database $_.database -Identity $_.mailboxguid -MailboxState SoftDeleted}

This example permanently deletes the disabled mailbox with the GUID 2ab32ce3-fae1-4402-9489-c67e3ae173d3 from mailbox database MBD01.

Remove-StoreMailbox -Database MBD01 -Identity “2ab32ce3-fae1-4402-9489-c67e3ae173d3″ -MailboxState Disabled
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s