Skip to content

Instantly share code, notes, and snippets.

@seriald
Created August 17, 2018 12:18
Show Gist options
  • Save seriald/4c911c9e501d20d828b0134da5436324 to your computer and use it in GitHub Desktop.
Save seriald/4c911c9e501d20d828b0134da5436324 to your computer and use it in GitHub Desktop.
Count the number of AD users given an OU
$OU = Read-Host -Prompt 'Enter the OU' #Example: OU=IMB,OU=HQ,DC=intra,DC=pri
(Get-ADUser -filter * -searchbase "$OU").count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment