PowerTip: Use PowerShell to Create OU in Active Directory

Doctor Scripto

Summary: Use Windows PowerShell to easily create an organizational unit in Active Directory.

Hey, Scripting Guy! Question How can I use Windows PowerShell to create a new organizational unit (OU) in Active Directory?

Hey, Scripting Guy! Answer Use the New-ADOrganizationalUnit cmdlet, and specify the name and path. A description is optional.
           If you want to easily delete the OU later, set the ProtectedFromAccidentalDeletion flag to false.
           Note  The following command is a one-line command that accomplishes this:

New-ADOrganizationalUnit -Name Charlotte -Path "dc=nwtraders,dc=com"
-Description "Charlotte office users" -ProtectedFromAccidentalDeletion:$false

0 comments

Discussion is closed.

Feedback usabilla icon