Move Computer Account to another OU vbscript

As part of our imaging process, after the computer is joined to the domain, based on the first production ID logging into the system, we run the attached vbscript.  The script is run using account credentials with rights in AD to move computers.

The goal of this script was to take a usergroup that every production ID belongs to (in the attached example, every production ID has a "home base" so to speak).  The script looks for the 'Base' group membership, and sets a variable for the OU where the computer account should be moved to.  If a new OU could not be determined, an email is sent to a list of people.  This was useful in our case so that #1: we can move the computer into the appropriate OU for Group Policy, and also we have other automation tasks that require production IDs to have a "base" group membership. 

If the script can correctly determine the target OU, it then looks for the computer account in 1 of two OU's:  The generial Computers OU, or in this script example, the Temporary OU.   It then moves the computer to the new OU.

If you plan on using this script, change the 3 variables at the top Company... to match valid email accounts, an SMTP internal server, and a sender email.  You would also need to adjust what group you're looking for, and set the OuToMoveTo = to be appropriate for you environment.

Attachment: MoveComputerOU.txt
Published Wednesday, July 11, 2007 9:30 AM by skissinger
Filed under:

Comments

No Comments