Skip to content

Instantly share code, notes, and snippets.

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