moving computers into varible OU's

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
matrix101
Posts: 7
Joined: Thu Jun 07, 2007 4:29 am

moving computers into varible OU's

Post by matrix101 » Thu Jun 07, 2007 4:46 am

Hello,I'm new to vbscript and am trying to figure out how to write a vbscript that will: move all computers in the computer container beginning with CSC to a specific OU named Corp-SD and/or all computers beginning wth DAL to the DAL-SD OU.I'm using a basic script Microsoft put out:Set objNewOU = GetObject("LDAP://OU=CORP-SD, OU=Workstations, OU=Managed Objects, dc=corp, DC=jitb, DC=net")Set objMoveComputer = objNewOU.MoveHere _ ("LDAP://CN=CSC*, CN=Computers, dc=corp, DC=jitb, DC=net", _ "CN=CSC*")This script works fine as long as your specify the computer name. All computers that belong in the CORP-SD OU start with CSC so I wanted to do something like CSC* but it didn't work. Any Ideas???Thx!

User avatar
matrix101
Posts: 7
Joined: Thu Jun 07, 2007 4:29 am

moving computers into varible OU's

Post by matrix101 » Thu Jun 07, 2007 4:46 am

Hello,I'm new to vbscript and am trying to figure out how to write a vbscript that will: move all computers in the computer container beginning with CSC to a specific OU named Corp-SD and/or all computers beginning wth DAL to the DAL-SD OU.I'm using a basic script Microsoft put out:Set objNewOU = GetObject("LDAP://OU=CORP-SD, OU=Workstations, OU=Managed Objects, dc=corp, DC=jitb, DC=net")Set objMoveComputer = objNewOU.MoveHere _ ("LDAP://CN=CSC*, CN=Computers, dc=corp, DC=jitb, DC=net", _ "CN=CSC*")This script works fine as long as your specify the computer name. All computers that belong in the CORP-SD OU start with CSC so I wanted to do something like CSC* but it didn't work. Any Ideas???Thx!

Locked