Creating an OU using PowerShell

It’s easy to use PowerShell to create a new organizational unit (OU) but how do you make sure first that an OU with that name doesn’t already exist in your Active Directory environment?

Here’s how you can do it where the OU name you want to check for is Sales

$ou = Get-ADOrganizationalUnit -Filter ‘name -eq “Sales” ‘;

if ($ou -eq $null)


     New-ADOrganizationalUnit -name Sales;


Mitch Tulloch is an eleven-time recipient of the Microsoft Most Valuable Professional (MVP) award and a widely recognized expert on Windows Server and cloud computing technologies.  For more information see

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top