If you do just a simple $mb in the shell, is it empty?
From: [email protected] [mailto:[email protected]] On
Behalf Of Heaton, Joseph@Wildlife
Sent: Friday, August 9, 2013 2:51 PM
To: [email protected]
Subject: [Exchange] RE: Getting rid of disconnected mailboxes
The variable took fine. Ran the second part as this:
[PS] C:\Windows\system32>foreach($m in $mb) {Remove-StoreMailbox -Database "DFG
Mailbox 1" -Identity $m.mailboxguid -Mai
lboxState SoftDeleted -confirm:$false}
Got this error:
Cannot bind argument to parameter 'Identity' because it is null.
+ CategoryInfo : InvalidData: (:) [Remove-StoreMailbox],
ParameterBindingValidationException
+ FullyQualifiedErrorId :
ParameterArgumentValidationErrorNullNotAllowed,Remove-StoreMailbox
Joe Heaton
Enterprise Server Support
CA Department of Fish and Wildlife
1807 13th Street, Suite 201
Sacramento, CA 95811
Desk: (916) 323-1284
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Michael B. Smith
Sent: Friday, August 09, 2013 11:37 AM
To: [email protected]<mailto:[email protected]>
Subject: [Exchange] RE: Getting rid of disconnected mailboxes
Separate it into two commands. What help file?
$mb = Get-MailboxStatistics -Database "Mailbox 1" | where
{$_.DisconnectedReason -eq "SoftDeleted"}
foreach( $m in $mb ) { Remove-StoreMailbox -Database "Mailbox 1" -Identity
$m.mailboxguid -MailboxState SoftDeleted }
If you want to suppress confirmations, add "-confirm:$false" immediately before
the final "}".
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Heaton, Joseph@Wildlife
Sent: Friday, August 9, 2013 2:30 PM
To: [email protected]<mailto:[email protected]>
Subject: [Exchange] Getting rid of disconnected mailboxes
My organization is in the process of migrating to CES (California Email
System), which is a customized version of O365. When users are migrated, their
mailboxes on -prem become disconnected. The problem with this is that I'm not
getting accurate counts of what's left in my databases. I want to get rid of
all the disconnected mailboxes. I have the following command from the help
file:
Get-MailboxStatistics -Database "Mailbox 1" | where {$_.DisconnectedReason -eq
"SoftDeleted"} | foreach {Remove-StoreMailbox -Database "Mailbox 1" -Identity
$_.mailboxguid -MailboxState SoftDeleted}
When I run this, I get lots of errors stating:
Pipeline not executed because a pipeline is already executing. Pipelines cannot
be executed concurrently.
+ CategoryInfo : OperationStopped:
(Microsoft.Power...tHelperRunspace:ExecutionCmdletHelperRunspace) [],
PSInvalidOperationException
+ FullyQualifiedErrorId : RemotePipelineExecutionFailed
It seems like I get one for each mailbox listed as disconnected for that
database. Afterwards, it asks for confirmations, but I don't know for sure
that the guid it's showing me is what I'm really wanting to delete. I tried
changing -Identity $_.mailboxguid, to -Identity $_.DisplayName. I didn't get
all the above errors, but I also didn't get any confirmations either, and the
boxes are still there.
Anyone have a corrective tip on this? Exchange 2010 SP2 ru5v2.
Thanks,
Joe Heaton
Enterprise Server Support
CA Department of Fish and Wildlife
1807 13th Street, Suite 201
Sacramento, CA 95811
Desk: (916) 323-1284