delete mutiple disconnected mailboxes from a list
I have multiple disconnected mailboxes that I would like to delete.
I have used the following commands that work great for deleting a single mailbox.
How could I use a list to pull mutliple names from and run this command only once?
$Temp = Get-MailboxStatistics | Where{$_.DisplayName -eq Tom}Remove-Mailbox -Database Mailbox Database -StoreMailboxIdentity $Temp.MailboxGuid
September 19th, 2008 7:45pm
Hi,
You can write a script to delete multiple disconnected mailboxes. It should be something like below (I didn't test this since I don't have test environment right now).
This will delete all the disconnected mailboxes which are in "Mailbox Database" mailbox store...
Code Snippet
$Temps = Get-MailboxStatistics | Where{$_.DisconnectDate -ne $null -and $_.Database -eq 'Mailbox Database'}
foreach ($Temp in $Temps){ Remove-Mailbox -Database "Mailbox Database" -StoreMailboxIdentity $Temp.MailboxGuid }
I would suggest you to do this in test lab first.
Free Windows Admin Tool Kit Click here and download it now
September 19th, 2008 8:33pm
Hi,
Please refer to following articles:
Removing disconnected mailboxes in Exchange Server 2007
http://msmvps.com/blogs/andersonpatricio/archive/2007/10/08/removing-disconnected-mailboxes-in-exchange-server-2007.aspx
Mike
September 26th, 2008 10:48am