Showing posts with label powershell. Show all posts
Showing posts with label powershell. Show all posts

Wednesday, June 01, 2011

Some usefull Exchange 2010 powershell scripts for space management

Force remove disconnected database after a move or delete
Remove-StoreMailbox -Database "" -Identity "" -MailboxState SoftDelete

Exchange 2010 Find Database White Space
Get-MailboxDatabase -Status | Select-Object Server,Name,AvailableNewMailboxSpace

Retrieve List of Disconnected Mailboxes
Get-MailboxDatabase | Get-MailboxStatistics | where {$_.DisconnectReason -eq “SoftDeleted”} | Select DisplayName,ServerName,Database,ItemCount

Permanently Delete all Disconnected Mailboxes across all Database
$var1 = Get-MailboxDatabase | Get-MailboxStatistics | where {$_.DisconnectReason -eq “SoftDeleted”}
$var1 | foreach {Remove-StoreMailbox -Database $_.database -Identity $_.mailboxguid -MailboxState SoftDeleted}