The Reconnect method allows a disconnected mailbox to be reconnected to an existing user object in
Microsoft Active Directory. The user must not already be mail-enabled.
Applies To
The Reconnect method is a member of the Exchange_Mailbox Class.
Instance Path
The Reconnect method appears on instances of the \\COMPUTERNAME\ROOT\MicrosoftExchangeV2:Exchange_Mailbox class.
MOF Syntax
[implemented] void Reconnect(
[in] string UserLogonName);
Qualifiers
implemented
Parameters
| Parameter | Description |
|---|
| UserLogonName | UserLogonName is a string (CIMTYPE=8) input parameter. |
VBScript Example
'===============================================================
' Purpose: Reconnect a Diconnected Exchange_Mailbox
' to another user object
' Change: cComputerName [string] the computer to access
' Change: cDisconnectedMbox [string] the disconnected mailbox name
' Change: cConnectTo [string] the user account to connect the mailbox to
'===============================================================
On Error Resume Next
Dim cComputerName
Dim cDisconnectedMbox
Dim cConnectTo
Dim objWMIService
Dim oDisMbox
Dim mBox
Const cWMINameSpace = "root/MicrosoftExchangeV2"
Const cWMIInstance = "Exchange_Mailbox"
cComputerName = "MyComputerNETBIOSName"
cDisconnectedMbox = "TestUserA"
cConnectTo = "TestUserB"
strWinMgmts = "winmgmts:{impersonationLevel=impersonate}!//"& _
cComputerName&"/"&cWMINameSpace
Set objWMIService = GetObject(strWinMgmts)
Set oDisMbox = objWMIService.ExecQuery("Select * from Exchange_Mailbox WHERE MailboxDisplayName = '" & cDisconnectedMbox & "'",,48)
For each mBox in oDisMbox
mBox.Reconnect cConnectTo
Wscript.Echo "Mailbox Reconnected"
Next
Remarks
When using the Reconnect method, the following limitations apply:
- It must run from the Exchange Server with the disconnected mailbox.
- You can not specify the domain for the reconnect attempt.
- The reconnect attempt will reconnect the mailbox to the first userid with a matching samaccountname in the forest.