Jump to content
Sign in to follow this  

Move computers to different OU

Recommended Posts


I have an old VBScript that moves PC from one OU to another. I attempted to convert to AutoIT, but am obviously missing something so simple I'll be embarrassed I asked.

Any ideas?

$CompName = "Testmachine01"

$objNewOU = ObjGet("LDAP://OU=Computers,OU=COMPANY,OU=ad,DC=SITE,DC=gov")

$objMoveComputer = $objNewOU.MoveHere _

("LDAP://CN=" & $CompName & ",OU=TEST,OU=Computers,OU=COMPANY,OU=ad,DC=SITE,DC=gov", "CN=" & $CompName)

EDIT: I get this error

$objMoveComputer = $objNewOU^ ERROR

(8) : ==> Variable must be of type "Object".:



Edited by stev379

Share this post

Link to post
Share on other sites

gov", "CN

shouldn't that comma be inside your " " ?

("LDAP://CN=" & $CompName & ",OU=TEST,OU=Computers,OU=COMPANY,OU=ad,DC=SITE,DC=gov, CN=" & $CompName)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.