Skip to content

Instantly share code, notes, and snippets.

@beci
Created April 17, 2019 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beci/17251bf394aec587bb5a3f9d4f9bd28b to your computer and use it in GitHub Desktop.
Save beci/17251bf394aec587bb5a3f9d4f9bd28b to your computer and use it in GitHub Desktop.
# with filter for only enabled
Get-ADUser -LDAPFilter "(&(objectCategory=person)(objectClass=user)(!userAccountControl:1.2.840.113556.1.4.803:=2))" -Properties * | select Name,UserPrincipalName,Enabled,LockedOut,Created,LastLogonDate | ConvertTo-Json > users_f.json
# with all users
Get-ADUser -Filter * -Properties * | select Name,UserPrincipalName,Enabled,LockedOut,Created,LastLogonDate | ConvertTo-Json > users.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment