VB Script to move computers in AD
Posted on 2005-03-25
I need a script that will move a computer from the "Computers" container in Active directory to an OU called "Test" inside of an OU called "Workstations"
Here's a diagram of how it looks
(This is where I'd like MyComputer to move to)
I hope that made sense. This is the script I'm currently using and running into errors with.
dim objOU, intReturn, objRootDSE, strDNSDomain
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("DefaultNamingContext")
Set objOU = GetObject("LDAP://OU=Workstations,OU=Test," & strDNSDomain)
intReturn = objOU.MoveHere _
("LDAP://CN=MyComputer,CN=Computers," & strDNSDomain, vbNullString)
I'm currently getting this Windows Script Host Error Message
Error: There is no such object on the server.