Monday, February 18, 2013

Quick Reconnect of a Disconnected Mailbox

This is what I use to quickly reconnect a disconnected mailbox. You'll need to know the alias/SamAccountName of the user to reconnect.

#Reconnect Disconnected Mailbox
#Get list of disconnected mailboxes
$mbxList=$mbxserver|%{(Get-Mailboxstatistics -Server $ | ?{ $_.DisconnectDate -ne $null })}
#Get the User to reconnect
$user=Get-User $idb
#Search for the user in the Disconnected Mailbox List
$dMB=$mbxlist|where {$_.displayname -match $user.DisplayName}|select displayName, mailboxGUID, Database
#Connect mailbox to user
Connect-Mailbox -Alias $user.SamAccountName -User $user -Database $dMB.Database -identity $dMB.MailboxGUID

No comments:

Post a Comment