New-ADUser -Path syntax?

14,685

Solution 1

From Technet:

Path
Specifies the X.500 path of the Organizational Unit (OU) or container where the new object is created. ...
The following example shows how to set this parameter to an OU.
-Path "ou=mfg,dc=noam,dc=corp,dc=contoso,dc=com"

Solution 2

The technet example posted by squillman is the first place I looked but it doesn't really offer any details on how the path is structured. It basically works like this;

Assuming you're trying to target the nested OU MyCountry>Mystate>Users and your domain is mycompany.int.com your -path parameter would look like this

-Path "OU=Users,OU=Mystate,OU=MyCountry,dc=mycompany,dc=int,dc=com"

Looking at the above you can pretty much see what going on. You target the nested OU by using multiple comma separated "OU=" starting at the specific OU and working your way backwards up the hierarchy.

The dc is also comprised of several comma separated "dc=" elements. To get this you basically break apart your domain at the periods and put each one into it's own dc element. So mycompany.int.com becomes dc=mycompany,dc=int,dc=com

Share:
14,685

Related videos on Youtube

leeand00
Author by

leeand00

Projects jobdb - Creator of Open Source Job Search Document Creator/Tracker http://i9.photobucket.com/albums/a58/Maskkkk/c64nMe.jpg Received my first computer (see above) at the age of 3, wrote my first program at the age of 7. Been hooked on programming ever since.

Updated on September 18, 2022

Comments

  • leeand00
    leeand00 almost 2 years

    Where can I find a detailed explanation of the -Path parameter of the New-ADUser command?

    I want to specify a rather detailed path without calling Set-Location many times to specify where I want the user created.