Skip to content

Instantly share code, notes, and snippets.

@lucasmelin
Created February 21, 2018 05:00
Show Gist options
  • Save lucasmelin/20c4cec136f4ec2122d6f1c670c7eb50 to your computer and use it in GitHub Desktop.
Save lucasmelin/20c4cec136f4ec2122d6f1c670c7eb50 to your computer and use it in GitHub Desktop.
Powershell script to get all disabled Active Directory users
Get-ADUser -Filter * -SearchBase "ou=Disabled Accounts" -Searchscope "onelevel" | select givenname,surname,samaccountname,whenchanged | Out-File "disabled_users.txt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment