Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 688

Reconnect Disconnected Mailbox Server for Exchange 2010- VBScript

$
0
0
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

Viewing all articles
Browse latest Browse all 688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>