Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

PS3 script for creating OU

$
0
0

I am looking for help creating a script to create an OU called "Secured Laptops" in several locations.

My AD structure has OU's like this:Region > City > PCs

Under PCs is Desktops and Laptops. I'd like to script creating the "Secured Laptops" under all the PCs OUs.    This is what I started. It does not fail, but the OUs are not created.:

$ChildOU = "Secured Laptops"

# Create default child OUs
 foreach ( $ChildOU in $ChildOUs )
 {
 New-ADOrganizationalUnit -Name $ChildOU -Path (Get-ADOrganizationalUnit -LDAPFilter '(Name=PCS)') -ProtectedFromAccidentalDeletion $True
 }


Viewing all articles
Browse latest Browse all 15028

Trending Articles