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.
This topic is 16 years and 9 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
matrix101
Posts: 7
Last visit: Mon Jun 21, 2010 12:01 pm

moving computers into varible OU's

Post by matrix101 »

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
Last visit: Mon Jun 21, 2010 12:01 pm

moving computers into varible OU's

Post by matrix101 »

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!
This topic is 16 years and 9 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked