How do I move existing mail enabled objects to a different OU during the Exchange Migration? (NETIQKB4556)

  • 7704556
  • 02-Feb-2007
  • 08-Sep-2008

Resolution

goal
How do I move existing mail enabled objects to a different OU during the Exchange Migration?

fact
Exchange Migrator 1.x

fact
Exchange Migrator 2.x

fix
Exchange Migrator (EM) does not move mail enabled accounts (disabled accounts created by ADC). However, this script would allow you to specify the location you want the account moved to. This script will move the account to a specified OU and update the SQL database with the new location of the migrated object.

NOTE: This script should be modified to work in your environment.

  1. Update the script with the location you want the objects moved to. (i.e., strTarget = "CN=Users,dc=domain,dc=domain,dc=com").
  2. Replace the sMachine value of 'ExMConsole' with the NETBIOS name of your Exchange Migrator console computer (i.e., sMachine = "MyConsole").
  3. Replace the sPwd value of 'password' with your SQL sa account password.
  4. Replace the sDb value of 'EMA' with the name of your Exchange Migrator database (EMA is the default during installation).
  5. In the Exchange Migrator "Specify Migration Options" wizard scripting window, select ?I will write VBScripts? option and check the ?Include IADs pointers to objects??.
  6. Cut and Paste the modified script into the 'Mailbox-PostProcess' event window.

Script:

'Post Mailbox Script should be pasted into the 'Mailbox-PostProcess' event

'Update the sMachine variable with the machineName (do not use a \\) of the ExM console (where the database is stored)
'Update the strTarget variable with the full path to the desired target OU

On error resume next

sMachine = "ExMConsole"
strTarget = "CN=Users,dc=domain,dc=domain,dc=com"

strContainer = "LDAP://" & strTarget
strUser = targetIADS.adspath
strPath = Split(targetIADS.adspath,"/")
strCont = Split(strPath(3),",",2)

sProps = split(sourceIADS.adspath, "/")

sProvider = sProps(0)
sServer = sProps(2)
sUser = sProps(3)

sPath = Split(sProps(3), ",", 2)

sCN = sPath(0)
sServ = sPath(1)

Set oOU = GetObject(strContainer)
oOU.MoveHere strUser, targetIADS.name                 ' IADsContainer

sUser = "sa"
sPwd = "password"
sDb = "EMA"

Const adCmdText = 1

   set cmd = CreateObject("ADODB.Command")
   set rs = CreateObject("ADODB.Recordset")
   set dbconn = CreateObject("ADODb.Connection")
  
   dbconn.Open "Provider=MSDASQL;Driver={SQL Server};Server=" & sMachine & _
            ";Uid=" & sUser & ";Pwd=" & sPwd & ";Database=" & sDb

   Set cmd.ActiveConnection = dbConn

   newContainer = "'" & targetIADS.name & "," & strTarget & "'"

   sSQL = "UPDATE MigrationInfo SET TargetContainer = " & newContainer & " WHERE TargetContainer = " & "'" & targetIADS.name & "," & strCont(1) & "'"

   cmd.CommandType = adCmdText
   cmd.CommandText = sSQL
  
   Set rs = cmd.Execute
   rs.close        



note

NetIQ is providing these scripts for Exchange Migrator only as a workaround.  The scripts and any related documentation is provided "AS IS," and NetIQ makes no warranties with respect to it, or its use or operation.  NetIQ has no responsibility for any impact arising from your use of the scripts provided.

Please be advised that NetIQ technical support does not troubleshoot script issues.  The script should be fully tested in your lab environment before using in any production environment.  Please do not use this script until you are completely sure that it will work based on your complete testing matrix in your lab environment. 



Additional Information

Formerly known as NETIQKB4556