Solved

Remove all soft deleted mailboxes Exchange 2010 SP1

Posted on 2013-06-05
2
1,567 Views
Last Modified: 2013-06-06
So I found this command on technet.

Get-MailboxStatistics -Database Mailbox2 | where {$_.DisconnectReason -eq "SoftDeleted"} | foreach {Remove-StoreMailbox -Database $_.database -Identity $_.mailboxguid -MailboxState SoftDeleted -confirm:$false}

Open in new window


It sort of works in that it will remove some of the soft deleted boxes, but I have to run it severl times, and then it will usually leave me with a dozen or so to manually remove. I'm splitting a DB, and every move leaves a dc'd maiblox. This is the error I get.

Pipeline not run because a pipeline is already running. Pipelines cannot be run concurrently.
    + CategoryInfo          : OperationStopped: (Microsoft.Power...tHelperRunspace:ExecutionCmdletHelperRunspace) [],
   PSInvalidOperationException
    + FullyQualifiedErrorId : RemotePipelineExecutionFailed

Open in new window

0
Comment
Question by:bhieb
2 Comments
 
LVL 16

Accepted Solution

by:
PaciB earned 500 total points
ID: 39223556
Hi,


Try by writing a .ps1 script file with these lines:

$MBList = Get-MailboxStatistics -Database Mailbox2 | where {$_.DisconnectReason -eq "SoftDeleted"}

$MBList | ForEach {
    $MB = $_
    Remove-StoreMailbox -Database $MB.database -Identity $MB.mailboxguid -MailboxState SoftDeleted -confirm:$false
}

Open in new window



Have a good day.
0
 

Author Comment

by:bhieb
ID: 39226600
Perfect thanks!
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video we show how to create a Distribution Group in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >>…
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now