Sorry, you need to put servername\ in from of the database name.
JJ
Darth_mark67
ASKER
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
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