Solved

exchange 2010 Remove disconnected mailboxes

Posted on 2012-03-16
9
755 Views
Last Modified: 2012-08-13
Hello,

How can I remove the disconnected test mailboxes off of my exchange 2010 server? I would like that to be all cleaned out.
0
Comment
Question by:Darth_mark67
  • 5
  • 4
9 Comments
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 37731661
Hello,

If you would like to remove all the disconnected mailboxes, you will need to do the following on each database that contains disconnected mailboxes:

Run the following commands in EMS:

$Users = Get-MailboxStatistics -Database "<Database Name>" | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid

$Users | ForEach { Remove-Mailbox -Database "<Database Name>" -StoreMailboxIdentity $_.mailboxGuid -Confirm:$false }

If you just want to delete specific mailboxes, you need to first get the MailboxGuid by running:

Get-MailboxStatistics -Database "<Database Name>" | where-object { $_.DisconnectDate -ne $null } | FL DisplayName, DisconnectDate, MailboxGuid

Once you have the MailboxGuid of the mailbox you want to purge, you would run:

Remove-Mailbox -Database "<Database Name>" -StoreMailboxIdentity <MailboxGuid>
JJ
0
 

Author Comment

by:Darth_mark67
ID: 37731667
Do I include the quotes?
0
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 37731675
Yes but replace <Database Name> with the actual name of the database. The quotes are needed because database names will include spaces.

JJ
0
 

Author Comment

by:Darth_mark67
ID: 37731693
Just to be clear it would be "0273334559" Which is the db name the install gave it.
0
Promote certifications in your email signature

Has your company recently won an award or achieved a certification? They'll no doubt want to show it off. Email signature images used to promote certifications & awards can instantly establish credibility with a recipient and provide you with numerous benefits.

 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 37731712
Yes, that would be the database name.

JJ
0
 

Author Comment

by:Darth_mark67
ID: 37731743
What did I do wrong? Here is the db info: Mailbox Database 0273334559\MSG

[PS] C:\Windows\system32>$Users = Get-MailboxStatistics -Database "0273334559" | where-object { $_.DisconnectDate -ne $n
ull } | Select DisplayName,MailboxGuid
Mailbox database "0273334559" doesn't exist.
    + CategoryInfo          : NotSpecified: (0:Int32) [Get-MailboxStatistics], ManagementObjectNotFoundException
    + FullyQualifiedErrorId : 898C4182,Microsoft.Exchange.Management.MapiTasks.GetMailboxStatistics

[PS] C:\Windows\system32>
0
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 37731769
Sorry, you need to put servername\ in from of the database name.

JJ
0
 

Author Comment

by:Darth_mark67
ID: 37731778
I tried it both ways, what am I screwing up?


         Welcome to the Exchange Management Shell!

Full list of cmdlets: Get-Command
Only Exchange cmdlets: Get-ExCommand
Cmdlets that match a specific string: Help *<string>*
Get general help: Help
Get help for a cmdlet: Help <cmdlet name> or <cmdlet name> -?
Show quick reference guide: QuickRef
Exchange team blog: Get-ExBlog
Show full output for a command: <command> | Format-List

Tip of the day #30:

Tab completion reduces the number of keystrokes required to complete a cmdlet. Just press the TAB key to complete the cm
dlet you are typing. Tab completion kicks in whenever there is a hyphen (-) in the input. For example:

 Get-Send<tab>

should complete to Get-SendConnector. You can even use wildcards, such as:

 Get-U*P*<tab>

Pressing the TAB key when you enter this command cycles through all cmdlets that match the expression, such as the Unifi
ed Messaging Mailbox policy cmdlets.

VERBOSE: Connecting to MSG.schulershook.net
VERBOSE: Connected to MSG.schulershook.net.
[PS] C:\Windows\system32>$Users = Get-MailboxStatistics -Database "msg\0273334559" | where-object { $_.DisconnectDate -n
e $null } | Select DisplayName,MailboxGuid
Cannot process argument transformation on parameter 'Database'. Cannot convert value "msg\0273334559" to type "Microsof
t.Exchange.Configuration.Tasks.DatabaseIdParameter". Error: "'msg\0273334559' is not a valid value for the identity.
Parameter name: Identity"
    + CategoryInfo          : InvalidData: (:) [Get-MailboxStatistics], ParameterBindin...mationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-MailboxStatistics

[PS] C:\Windows\system32>$Users = Get-MailboxStatistics -Database "0273334559\MSG" | where-object { $_.DisconnectDate -n
e $null } | Select DisplayName,MailboxGuid
Cannot process argument transformation on parameter 'Database'. Cannot convert value "0273334559\MSG" to type "Microsof
t.Exchange.Configuration.Tasks.DatabaseIdParameter". Error: "'0273334559\MSG' is not a valid value for the identity.
Parameter name: Identity"
    + CategoryInfo          : InvalidData: (:) [Get-MailboxStatistics], ParameterBindin...mationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-MailboxStatistics

[PS] C:\Windows\system32>
0
 
LVL 37

Accepted Solution

by:
Jamie McKillop earned 500 total points
ID: 37731799
Run get-mailboxdatabase | fl and look for the "server" and "name" properties. then use -Database "server\name". If that doesn't work, look for the guid property and use -Database "guid"

JJ
0

Featured Post

Too many email signature updates to deal with?

Do you feel like you are taking up all of your time constantly visiting users’ desks to make changes to email signatures? Wish you could manage all signatures from one central location, easily design them and deploy them quickly to users? Well, there is an easy way!

Join & Write a Comment

Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
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.
In this video we show how to create an Accepted Domain 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 Mail Flow >> Ac…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

762 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

20 Experts available now in Live!

Get 1:1 Help Now