Reconnect Disconnected Mailbox Server for Exchange 2010- VBScript

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

On Exchange 2010 you need to use the Exchange Management Shell so you need to use the connect-mailbox cmdlet see
http://technet.microsoft.com/en-us/library/bb123490(v=exchg.141).aspx
If your trying to do this from managed code then you can run that cmdlet from managed code see
http://msdn.microsoft.com/en-us/library/bb332449(v=exchg.80).aspx and
http://blogs.technet.com/b/exchange/archive/2009/11/02/3408653.aspx
Cheers
Glen

Similar Messages

  • Connecting CAS Server to Mailbox Server in Exchange 2010

    Currently, we are running the CAS,HUB,and Mailbox role on the same Exchange 2010 SP3 server. At some point I would like to separate this out. Should be an easy question: what command gets/sets the settings which points a CAS array to a mailbox database?
    So I want CAS_SERVER1 -> DB1,DB2 and CAS_SERVER2 -> DB3,DB4

    Hi,
    In Exchange 2010, Outlook look for the “rcpclientaccessserver” attribute on the user’s Database to find the CAS server. You can manually set it by the following command:
    Set-mailboxdatabase –rcpclientaccessserver xxx
    Thanks,
    Simon Wu
    TechNet Community Support

  • Removing mailbox server from Exchange 2010 DAG - Node not fully cleaned up

    Hi,
    We are in the process of decommissioning some old Exchange 2010 servers. I have just attempted to remove one of our mailbox servers and have received a number of errors, related to its removal from the DAG.
    I have already removed the Public Folder replicas and all mailbox database copies. I then tried to evict the server from the DAG and received the following warning:
    I then ran the command that was recommended, from another server and in an administrative command prompt:
    I have looked in this log on both the server I ran the command on, a CAS server, and the mailbox server itself and can see no evidence of this error 2 that is listed here.
    If I run the Powershell command to look at the DAG I cannot see it there any more. I am assuming that this error message might only be an issue if I was planning on re-using this server somewhere else in Exchange or perhaps adding this server to another
    DAG. But I just want to decommission it.
    Can anyone put my mind at rest as to whether this is a genuine concern or not. If not my next step is to uninstall Exchange 2010 from this server and turn it off.

    Hi Belinda,
    I get the following:
    [PS] C:\Windows\system32>Get-DatabaseAvailabilityGroup
    Name             Member Servers                                                         
    Operational Servers
    DAG01            {WSR-EX-01, WSR-EX-101, WSR21}
    It doesn't look like that server is part of the DAG any more as far as I can see. I just can't explain that error message reported from the cluster command. As far as I can see the server is isolated. I already removed its database copies as a pre-requisite
    before removing it from the DAG as per this guide:
    http://www.experts-exchange.com/Software/Server_Software/Email_Servers/Exchange/Q_27039933.html
    I found a nice little script that gave reports on your Public Folder configuration and it highlighted that some of our folders were not being replicated properly across our mailbox servers. This helped me in removing these services from the server.
    It is currently doing nothing at this time as far as Exchange Services are concerned.

  • Converting a VBScript for Exchange 2003 to Function the same for Exchange 2010

    Converting a VBScript for Exchange 2003 to Function the same for Exchange 2010
    Afternoon;
    I've run into a problem at this time.  We are currently looking into migrating from Exchange 2003 into Exchange 2010 and I'm finding that my normal data collection method is no longer usable in Exchange 2010.  I have the script posted below as of
    what I'm currently using to collect my information, I just need to know of a means to continue the collection when we move to the new Exchange server.  Any assistance in getting this to function with Exchange 2010 would be great.
    ++++++++++++++++++++++++++++++++++++++++++++++++++
    ++++++++++++++++++++++++++++++++++++++++++++++++++
    On Error Resume Next
    'Date Stamp for File Name
    Function TIMESTAMP
      strDate = CDate(Date)
      strDay = DatePart("d", strDate)
      strMonth = DatePart("m", strDate)
      strYear = DatePart("yyyy", strDate)
      If strDay < 10 Then
        strDay = "0" & strDay
      End If
      If strMonth < 10 Then
        strMonth = "0" & strMonth
      End If
      TIMESTAMP = strYear & strMonth & strDay
    End Function
    'Drop Location Vars Set
    DRP01 = 1
    DRP02 = 1
    'Live Check SQL04
    strVIC = "SQL04"
    Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
    Set colItems = objWMIService.ExecQuery ("Select * from Win32_PingStatus Where Address = '" & strVIC & "'")
    For Each objItem in colItems
        DRP01 = objItem.StatusCode
    Next
    'Live Check FS02
    strVIC = "FS02"
    Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
    Set colItems = objWMIService.ExecQuery ("Select * from Win32_PingStatus Where Address = '" & strVIC & "'")
    For Each objItem in colItems
        DRP02 = objItem.StatusCode
    Next
    'Setup STOREDIR Location
    If DRP01 = 0 Then
        STOREDIR = "\\SQL04\Email\Collected\" 'Primary Data Storage Location
        Else
        If DRP02 = 0 Then
            STOREDIR = "\\FS02\Shared\MIS\Daniel\" 'Secondary Data Storage Location
            Else
            STOREDIR = "C:\Scripts\Logs\" 'Tertiary Data Storage Location
        End If
    End If
    'STOREDIR Check for Availability
    Set fso = CreateObject("Scripting.FileSystemObject")
    If fso.FolderExists(STOREDIR) Then
        AVAIL = 1
        Else
        AVAIL = 0
    End If
    'Sets Failsafe STOREDIR
    If AVAIL = 0 Then
        STOREDIR = "C:\Scripts\" 'Last Chance DIR for Data Files
    End If
    'Sets Filename
    FILENAME = TIMESTAMP & ".csv"
    'Testing Purposes Only
    'wscript.echo TIMESTAMP
    'wscript.echo STOREDIR & vbNewLine & FILENAME & vbnewline & vbnewline & AVAIL
    'Sets Process Variables
    cComputerName = "EXCH02" ' Exchange Server Name or IP Address
    DIM fso, ObjFile
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set ObjFile = fso.CreateTextFile(STOREDIR & FILENAME, True)
    'ObjFile.WriteLine("Date,Display Name,Size(KB)")
    Const cWMINameSpace = "root/MicrosoftExchangeV2"
    Const cWMIInstance = "Exchange_Mailbox"
    Dim strWinMgmts            
    Dim objWMIExchange   
    Dim listExchange_Mailboxs  
    Dim objExchange_Mailbox           
    strWinMgmts = "winmgmts:{impersonationLevel=impersonate}!//" & cComputerName &"/" & cWMINameSpace
    Set objWMIExchange =  GetObject(strWinMgmts)
    'Checks for Email Record and Records to File
    If Err.Number <> 0 Then
      ObjFile.WriteLine("ERROR:" & VBNEWLINE & Err.Number & VBNEWLINE & Err.Description)
    Else
      Set listExchange_Mailboxs = objWMIExchange.InstancesOf(cWMIInstance)
      If (listExchange_Mailboxs.count > 0) Then
        For Each objExchange_Mailbox in listExchange_Mailboxs
           ObjFile.WriteLine(TIMESTAMP & "," & objExchange_Mailbox.MailboxDisplayName & "," & objExchange_Mailbox.Size)
        Next
      Else
        ObjFile.WriteLine("WARNING: No Exchange_Mailbox instances were returned.")
      End If
    End If
    ObjFile.Close
    VBScript is what I prefer. All scripts must have a kill switch to manage them from a primary location. Mine, is an updater method.
    VBScript is what I prefer. All scripts must have a kill switch to manage them from a primary location. Mine, is an updater method.

    Okay, then what about an alternative for getting the same result. The file associated in the article is too much.  All we need is something simple for a single exchange server with 180 users.  We only need to pull UserName and DataSize(KB).
    I only need to collect two pieces of information from the exchange server and the third piece is forced due to the date of when the information was collected.  This way I can sort and filter by Date and Name to see a trend of the users mailbox usage
    size.
    Every day this runs, it determines the date of the file which is also the first piece, then pulls from the exchange server the entire list of users (the second piece), and then the respective user's mailbox size in KB (the third piece).  This all is
    dropped into a CSV file later used to import into a database before being archived, done by a second task on the server.  Later used by a shared Excel PowerPivot document among the department.
    Those of us in the server admin group use this to, at a glance, see the collective size of email usage on the server.  Mainly used as a means of catching an incident before it happens.  We are currently keeping our users around a collective 80GB
    of use out of the well received limit of 110GB on Exchange 2003 and limiting the user's ability to send and receive email by email quota is apparently not accepted for us to do.  So we use this to determine who we need to visit and force archive their
    email so the server doesn't fail due to the size limit.
    VBScript is what I prefer. All scripts must have a kill switch to manage them from a primary location. Mine, is an updater method.

  • Outlook 2007 Clients Cannot Access Free/Busy Calendar info. for Exchange 2010 Mailbox

    Hi:
    I have Outlook 2007 clients that cannot access Free/Busy Calendar info. for Exchange 2010 mailboxes.  They receive error like "...you do not have appropriate permissions..."
    If those same users logon to a machine running Outlook 2010 then they can view the free/busy info. of the other user's mailbox, so I believe the permissions are set correctly on the mailbox to allow the viewing.
    Any insights are greatly appreciated!
    Thank you!
    Bob Herman IT Tropolis

    Hi Herman,
    As you said, it seems users have proper permissions on mailbox.
    Please make sure users has Reviewer permission on Outlook 2007.
    Please try to run Outlook 2007 under safe mode or re-create profile.
    Also try to turn Outlook 2007 to Exchange Online mode from Cached mode.
    Thanks
    Mavis Huang
    TechNet Community Support

  • Configuration for LDAP IP Address and Port for Exchange 2010

    Let's say Exchange 2010 is installed on a computer that is joined to a domain. However, I would like to redirect LDAP authentication to another IP address and another port like how sharepoint implement it below
    http://sharepoint.stackexchange.com/questions/33540/ldap-authentication-connection-string
    Is it possible to do the equivalent for Exchange 2010?
    Note: I would like to do this without installing any Edge Transport server or Microsoft Forefront TMG

    The question I would need to ask is "Why would you need to do this?"  I ask because Exchange requires an Active Directory account for authentication.  That account may have permissions from some other directory (as in a linked mailbox),
    but the account is used to find it.  For SharePoint, you can authenticate to other directories directly.

  • Transport Rule MessageSizeOver for exchange 2010

    Hi 
    I have an exchange 2010 SP3 RU 3 environment with edge transport server implemented. I want to Have Transport rules to limit message size going outside/coming inside on edge transport.
    I recently found a solution with -messagesizeover switch for new-trasportrule command in exchange 2013. Unfortunately its unavailable in exchange 2010. 
    I am wondering if there is a workaround or update for exchange 2010 to add this functionality.
    Thanks in advance
    Farhad

    Hi,
    On Exchange 2010, there is no MessageSizeOver parameter when you create a transport rule. But you can limit the sending and receiving message size of the whole Exchange organization using the following cmdlet.
    Set-TransportConfig -MaxReceiveSize xxx -MaxSendSize xxx
    If you want to limit the sending and receiving messages size for a specific mailbox, you can use the cmdlet below.
    Set-Mailbox xxx –MaxSendSize xxx –MaxReceiveSize xxx
    Hope it helps.
    Best regards,
    Amy Wang
    TechNet Community Support

  • Forefront for exchange 2010 setup wizard preinstall update request

    I'm trying to install FPE, but even before I install and after the extraction of the files im getting the following error message on both my CAS servers.
    I have the following roles installed on this Client Access Server im using for the initial install of Forefront.
    Do I need to install active directory domain services before I continue.

    Hi,
    Firstly, please refer to the similar thread below:
    FSEMachinePrep.exe
    fails saying Server Unavailable
    Based on my research,
    Microsoft Forefront Protection 2010 for Exchange Server (FPE) can be deployed on Exchange Edge Transport, Hub Transport, Mailbox server, or combined
    Hub/Mailbox roles.
    Exchange 2010 requires Active Directory to be in place except for the Exchange 2010 Edge role (for DMZ) which can be deployed in a workgroup with Active Directory Lightweight
    Directory Services. Both Exchange (Mailbox, HUB and CAS role) and therefore FPE requires an Active Directory on site.
    Did you set up a domain environment for exchange server? If yes, please check the group membership of the user and make sure that it is a member of the Organization
    Management role group. In addition, please also make sure that you can connect to the primary domain controller on the CAS servers.
    More information:
    Microsoft Exchange Server 2010: Exchange Server and Active Directory
    Best regards,
    Susie

  • Disater Recovery for exchange 2010 plan.

    Hi All,
    Happy New year 2014 ....
    we have running with exchange 2010 R1 with DAG enabled. we have below mentioned setup in our exchange server.
    Main site.
    Active directory server ( Primary DC, additional DC in our main site)  installed in Hyper V  host. installed exchange 2010 mail box role in another Hyper V host.  installed the CAS& Hub role in another virtual host and installed the Exchange
    edge role in another physical server.
    DR Site
    Active director server( ADC) installed in Hyper V host. installed the Exchange 2010 mailbox,Hub,Cas server role in a physical server. installed the Edge Server in another physical server.
    At present we have enabled the failover DAG  for both our Mail box servers and its working perfectly when the primay mail box server down. we have run some commands to transfer all my exchange 2010  to point through our DR Site. so its take
    some of the minutes of down time happened in our mail flow.  we are planning to avoid that downtime. we  are find for the solutions like  if the primary site down  the DR will need to automatically up. it will be appreciate that any
    one  provide your suggestion to achieve this without affecting the  our current setup.
    Jags

    Hello,
    Kindly find the 3 types of plan for Exchange 2010 DR site. You can check all 3 plans and select as per your requirement.
    1. Rebuild an Entire Database Availability Group plan
    http://technet.microsoft.com/en-us/library/gg513521.aspx
    2. Site Resiliency in Exchange 2010
    http://www.msexchange.org/articles-tutorials/exchange-server-2010/management-administration/planning-deploying-testing-exchange-2010-site-resilient-solution-sized-medium-organization-part1.html
    3. Exchange 2010 Cross Site DAG Disaster Recovery: Data Center/AD Site failure Part 1
    http://msexchangeguru.com/2012/10/25/exchange-2010-dag-dr/
    Deepak Kotian. MCP, MCTS, MCITP Exchange 2010 Ent. Administrator

  • How to set default website for exchange 2010

    I'm unable to launch the Exchange Management Console, and then I read that it's necessary to set the default web site in a particular way, in order for Exchange 2010 Management Console to work:
    http://social.technet.microsoft.com/Forums/en/exchange2010/thread/4d396628-3867-4c95-9541-e0eb021e0135
    However, after setting up Sharepoint, I see that it has modified the default website, and I'd like to ask for specific settings on how the default web site bindings should look (for exchange). Could someone please advise what I need to do to correct it?
    I'm having trouble interpreting what Mike Crowley recommends in the linked post above, in terms of actual steps to the site binding information (which won't mess up what exists).
    Currently it says:
    Type           port         ip address        binding information
    net.tcp                                            
    808:*
    net.pipe                                          
    net.msmq                                         localhost
    msmq.formatname                            localhost
    http            80             127.0.0.1
    https          443            *
    http           80              *
    https          443            127.0.0.1
    It seems the line for http on port 80 is *, which I guess is equivalent to 'all unassigned'. Is the previous http port 80 binding to 127.0.0.1 causing the problem?
    But I'm also supposed to set a Powershell VDir in IIS. Can someone provide steps for that? 

    Regarding SharePoint on Exchange:
    It was not allowed earlier, as documented here:
    http://office.microsoft.com/en-us/sharepoint-portal-server-it/coexistence-and-interoperability-guide-for-sharepoint-products-and-technologies-HA001160777.aspx & here:
    http://support.microsoft.com/kb/825505 but there doesn't seem to be anything more recent than this.  I would work under the assumption it is not supported outside of
    SBS 2011 (which I am not very familiar
    with).
    Mike Crowley
    Check out My Blog!

  • How to do the hard recovery for exchange 2010 (No Restore.env generated)

    enrollment:Windows server 2008 R2, exchange 2010.
    I want to test the fundamentally of eseutil /cc
    so I backup the exchange database by Using the Windows backup, then I restore the database, and no Restore.env be found.But  I found I can run the
    eseutil /r.
    what's happened? 
    1,why No Restore.env generated for exchange 2010 in Windows server 2008 r2?
    2,why I can do the soft recovery after the restoring the database? 
    3, how to do the hard recovery for this situation(No Restore.env )?
    Please click the Mark as Answer button if a post solves your problem!

    Hi Eric,
    From your description, I would like to clarify the following things:
    1. Before performing the restore process, we need to dismount the Exchange databases that we want to restore. If the database is still mounted, the restore process will fail. If the restore process doesn't succeed, Restore.env won't be generated.
    2. It is because the log files are healthy, you can run Eseutil/r and perform soft recovery.
    3. In your case, you can continue to perform the soft recovery.
    For more information about hard recovery and soft recovery, here are some helpful threads for your reference.
    Exchange Server Soft and Hard Recovery
    http://technet.microsoft.com/en-us/library/aa996168(v=exchg.65).aspx
    Exchange Database Recovery – Using eseutil commands (Note: It isn't from Microsoft, please pay attention to refer to it.)
    http://msexchangeguru.com/2009/07/12/exchange-database-recovery-using-eseutil-commands/
    Hope it helps.
    If there any problems, please feel free to let me know.
    Best regards,
    Amy
    Amy Wang
    TechNet Community Support
    " If the restore process doesn't succeed, Restore.env won't be generated. "
    thank you for you reply.The restore process  succeed,otherwise I can't do the soft recovery after the restoring the database,but can't see the restore.env
    Please click the Mark as Answer button if a post solves your problem!

  • Mails blocked in queue the moment forefront for exchange 2010 started

    Hi,
    We have newly installed Forfront protection 2010 for Exchange 2010 installed in our exchange 2010 Edge Server.
    Mails got struck in the Queue immediatly after the forefront installations.
    Mailflow works properly one we unhook the forefront from Exchange.
    need to enable the forefront. Got struck in these. How to proceed up further.
    Thanks,
    Pradeep

    Hi,
    Please compare your configuration with the following blog or video. These might help.
    http://araihan.wordpress.com/2010/03/15/forefront-protection-2010-how-to-install-and-configure-forefront-protection-2010-for-exchange-server-2010step-by-step/
    http://www.youtube.com/watch?v=b2BgTmeXwUs
    (Note: Microsoft provides third-party contact information to help you find technical support. This contact
    information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.)
    Best Regards,
    Joyce
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Forefront for exchange 2010 - how long?

    Hi there.
    Read this article: http://blogs.technet.com/b/server-cloud/archive/2012/09/12/important-changes-to-forefront-product-roadmaps.aspx
    I would have additional question.
    Our company is MS Gold Partner and we need to renew our yearly license every year around AUGUST.
    We are thinking about changing our SPAM filter external gateway with exchange edge, but as we can see from that article, you Will be unable to renew it license after December 2015.
    I know that Microsoft offers online Forefront protection but that is not option in our case because of data sensitivity.We need an answer how long we Will be able to get updates regarding forefront for exchange 2010 and be licensed ok?
    I guess after 2015 december Forefront Exchange 2010 Will no longer recieve spam updates thru Windows update, right?
    And also engines Will not be updated after that date?
    Is this the correct view and understanding?
    with best regards
    bostjanc

    Hi Bostjanc,
    >>how long we Will be able to get updates regarding forefront for exchange 2010 and be licensed ok?
    I think you must have seen the information below in that blog.
    For current customers, Microsoft will continue to support the subscription through Dec.31, 2015. If customer subcriptions expire before Dec.31, 2015, and annot be renewed because the product is no longer offered, these products will continue to be supported
    through that date in order to provided with customers sufficient time to move to alternative solutions.
    You could also check the following blog.
    License extension for End-of-Life Antigen/Forefront products
    Note: Microsoft provides third-party contact information
    to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.
    If the information above still cannot resolve your questions, please contact Microsoft to get definitive answers.
    Best Regards,
    Joyce
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Forefront protection for exchange 2010 - updates?

    Installed Exchange EDGE server with Forefront Protection for Exchange 2010.
    Installed hotfix update rollup 4 for forefront (I think it's the latest because I haven't found any newer).
    We have basically left everything on default in forefront, and if we take a look on dashboard in gui we see this error message:
    not all the antimalware engines selected in the forefront adminstration console for scanning have been enabled for updates.
    where should we take a look whats not being updated. Please a little help.
    with best regards,
    bostjanc

    Hi.
    Meanwhile I have also found information that it has been retired
    https://social.technet.microsoft.com/Forums/forefront/en-US/400fa485-edc9-499f-8294-c196496437d8/not-all-of-the-antimalware-engines-enabled-for-updates-successfully-updated-at-the-last-attempt?forum=FSENext
    bostjanc

  • New mailbox move request Exchange 2010 : queued

    I have deployed new Exchange 2010 server in Exchange 2003 Organization.  It is simple setup one Exchange 2003 and   New Exchange 2010.
    I was trying to move mailbox from Exchange 2003 to 2010 and it has status of QUEUE “indefinetly”.. I have tried several mailboxes  and result is the same.
    Then I decided to create new database on Exchange 2010 sever. I have crate new mailbox on Exchange 2010 sever, send and receive some emails. And then try to move mailbox to new database. Same results.
    I run test MSR replication and is ok.
    I have increase msr LOGGING TO Maximum, no errors. I have rebooted server several times, no differences…

    Hi,
    Based on the description, status of mailbox move request from Exchange 2003 to Exchange 2010 is "indefinitely".
    Please make sure mailbox databases in Exchange 2010 and Exchange 2003 are mounted.
    Have you moved mailbox using the New-MoveRequest with the BadItemLimit and the AcceptLargeDataLoss parameters? If not, it's worth to do it again. Before you create a new move request, please check if there is any previous move request. If there is, please
    clear the previous move request and then move the mailbox.
    If the issue persists, please try to move mailbox to another database in Exchange 2003 and then move to Exchange 2010 to check the result.
    Best regards,
    Belinda
    Belinda Ma
    TechNet Community Support

Maybe you are looking for