PowerShell Create OUs from an array

 PowerShell Create OUs organizational units in your domain from an array -
write-host "building OU for: $array"
$array = ("Human Resources","Purchasing",
"Production","Marketing","Information Technology","Sales","New York",
"Kansas City","Los Angeles","Building 125","Town Pavilion",
"Architecture","Center Square","925 Grand","WallStreet Tower")
#New-ADOrganizationalUnit -Name SOME+NAME -Path
#CHANGE OU/NAME /DC= to modify for DC
#"OU=NAME,DC=NAME,DC=NAME"
#build array and do it to it
#MAKE AN OU CALLED OU=buildings
#CHANGE OU/NAME /DC= to modify for DC
foreach ($item in $array)
 { New-ADOrganizationalUnit -Name $item
       -Path "OU=buildings,DC=brilliantly,DC=com"}

PS .\buildings_Create_OU.ps1

building OU for: Human Resources Purchasing Production Marketing
Information Technology Sales New York Kansas City Los Angeles
Building 125 Town Pavilion Architecture Center Square 925 Grand WallStreet Tower

PS C:\Users\adm-easy\Desktop\powershell\MOSES AD builder>

ou_create.png

share with friends

Share to Google Buzz
Share to Google Plus
Share to LiveJournal
Share to Odnoklassniki
No comments yet.

Leave a Reply