Avatar of Kelly Garcia
Kelly Garcia
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Automate PC's, Laptop to correct OU

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
PowershellActive DirectoryScripting Languages

Avatar of undefined
Last Comment
Kelly Garcia

8/22/2022 - Mon
Joseph Moody

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 Garcia

ASKER
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
ASKER CERTIFIED SOLUTION
Chris Dent

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Kelly Garcia

ASKER
Fantastic!
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck