$domain = get-addomain | select -expand distinguishedname $facilities = "facilityname" $OUS = "Groups","Kiosks","Laptops","Users","Workstations" foreach ($facility in $facilities) { New-ADOrganizationalUnit "$facility" foreach ($OU in $OUS) { NEW-ADOrganizationalUnit “$OU” –path “OU=$facility,$domain” } }
A very simple script I made to quickly create some OUs with sub-OUs inside. Basically all I need to add is facility names and the OUs will be created for them.
The script took less than a minute to write but will probably save me up to 20 minutes!