Creating bulk organizational units in Active Directory with PowerShell

Published: 07 September 2021
on channel: Sysengineer
1,801
60

In this video I am going to show you how to create bulk OUs in Active Directory using PowerShell ISE. I will be running Windows Server 2022.

Be sure to follow me on tiktok! @sysengineer https://vm.tiktok.com/ZMRPrc1Ed/

Download the ISO here: https://www.microsoft.com/en-us/evalc...



To create a new OU - New-ADOrganizationalUnit -Name "State" -Path "OU=State,DC=sysengineer,DC=local"


This script is used for creating bulk organizational units.

Import active directory module for running AD cmdlets
Import-Module activedirectory

#Store the data from the CSV in the $ADOU variable.
$ADOU = Import-csv C:\Users\Administrator\Desktop\ou.csv

#Loop through each row containing user details in the CSV file
foreach ($ou in $ADou)
{
#Read data from each field in each row and assign the data to a variable as below

$name = $ou.name
$path = $ou.path

#Account will be created in the OU provided by the $OU variable read from the CSV file
New-ADOrganizationalUnit `
-Name $name `
-path $path `

}




Music: Intentions (Instrumental Version) [Originally Performed by Justin Bieber & Quavo]
Source: https://activedirectorypro.com/create...


Watch video Creating bulk organizational units in Active Directory with PowerShell online, duration hours minute second in high quality that is uploaded to the channel Sysengineer 07 September 2021. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 1,801 times and liked it 60 visitors.