none
Reconnect Disconnected Mailbox Server for Exchange 2010- VBScript RRS feed

  • Question

  • Hello everyone. I am trying to run a program where a user can reconnect a disconnected mailbox through 2010 Exchange Servers. 

    This is an example of the method that I need except this is for 2003 servers but I am looking for 2010. If you can, please help me out. 

    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
    • Moved by Reed KimbleMVP Tuesday, June 17, 2014 8:06 PM exchange vb script question from VB.Net
    Tuesday, June 17, 2014 7:30 PM

All replies