We help IT Professionals succeed at work.

Automate PC's, Laptop to correct OU

210 Views
Last Modified: 2017-03-29
Hi,

We have recently installed Quest Active Acroles and there is a way of automatically placing laptops and PCS to the correct OU's. Example we have laptops with the naming convention LP-LON-01, LP means it is a laptop and LON means it is based in London therefore this machine should be placed in the London laptop OU. How do we achieve this. Is there a script any one have in order to do this so that  we may then import this script as a module on active roles.

Thank you in advance.

kelly
Comment
Watch Question

Joseph MoodyBlogger and wearer of all hats.
CERTIFIED EXPERT

Commented:
You can use PowerShell to do this. Here is a guide that I put together a few years ago. It uses the Quest AD cmdlets but you can also use the native AD cmdlets if you wish:

https://deployhappiness.com/move-computer-to-ou-based-on-name-automatically/

Let me know if you have any issues.
Kelly GarciaSenior Systems Administrator

Author

Commented:
there is an onpostcreate script module on active roles, when I import that module it gives me

function onPostCreate($Request)
{



}

Open in new window


so my thoughts right now are:

function onPostCreate($Request)
{

if (Get-QADComputer $request| ? {$_.name -like 'lp-lon*'})
{
#move to London OU

}

}

Open in new window


not sure if this will work.

regards,
kay onpostcreate_1.JPGonpostcreate.JPG
PowerShell Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
Kelly GarciaSenior Systems Administrator

Author

Commented:
Fantastic!