Advertisement
dantpro

OU Account Count

Jun 27th, 2014
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $OU="ou=Users,dc=domain,dc=dom"
  2.  
  3. #$SS="OneLevel"
  4. $SS="SubTree"
  5.  
  6. Write-Host "All Accounts:"
  7. (Get-ADUser -SearchBase $OU -SearchScope $SS -filter *).count
  8.  
  9. Write-Host "Enabled Accounts:"
  10. (Get-ADUser -SearchBase $OU -SearchScope $SS -filter *|where {$_.enabled -eq "True"}).count
  11.  
  12. Write-Host "Disabled Accounts:"
  13. (Get-ADUser -SearchBase $OU -SearchScope $SS -filter *|where {$_.enabled -ne "False"}).count
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement