Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to list disconnected mailboxes on all servers

PowerShell

How to list disconnected mailboxes on all servers

by  markdmac  Posted    (Edited  )
The below simple script will query all databases to list disconnected mailboxes. Note that when you first disable/disconnect a mailbox, it may not be listed in the GUI or PowerShell. Running Clean-MailboxDatabase will correct this temporary state. (not necessary if normal nightly cleanup has run already but won't hurt)

Code:
[color #4E9A06]#List the databases and clean them to show any mailboxes not showing yet.[/color]
Get-Mailboxdatabase | Clean-MailboxDatabase
[color #4E9A06]# Create an array of server names.  Change to your server names.[/color]
$Servers = @("[color #CC0000]server1[/color]","[color #CC0000]server2[/color]","[color #CC0000]server3[/color]")
[color #4E9A06]# Now display our disconnected mailboxes.[/color]
ForEach ($Server in $Servers){
Get-MailboxStatistics -Server $Server | where { $_.DisconnectDate -ne $null } | select DisplayName,DisconnectDate}
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top