I'm creating a script that moves users from one Active Directory (AD) organizational unit (OU) to another AD OU according to data in a comma-separated value (CSV) input file. As Figure 1 shows, each line of the input file contains two fields: the user's common name (cn) and computer type (Desktop or Laptop). I'm using the computer type to control the OU that each user moves to. For example, I'm moving users with desktop computers from the ou=corp,dc=MyDomain,dc=com OU to the ou=Desktops,dc=MyDomain,dc=com OU and users with laptop computers from the ou=corp,dc=MyDomain,dc=com OU to the ou=Laptops,dc=MyDomain,dc=com OU. I've had success opening the input file and creating a log file. My dilemma is parsing the data and performing the move operation. Can you point me in the right direction?
You betListing 1, page 10, is a reworked version of the UserMove.vbs script you sent me. Let's walk through the script, which should help you identify where you took a wrong turn. . . .


Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\Scripts\moveuser.xls")
intRow = 2
Do Until objExcel.Cells(intRow,1).Value = ""
Set objUser = GetObject("LDAP://us0-dc01/" & objExcel.Cells(intRow, 1).Value)
objOU.MoveHere("LDAP://us0-dc01/", & objExcel.Cells(intRow, 2).Value) , ("cn=", & objExcel.Cells(intRow, 3).Value)
intRow = intRow + 1
Loop
objExcel.Quit
Connollyr12 September 01, 2004 (Article Rating: