Simple PowerShell Scripts to Gather user information

**NOTE if running from a DC and a non 500 account, ensure Command prompt is elevated!

Get all users where Password does not expire.

Get-ADUser -LDAPFilter ‘(&(userAccountControl:1.2.840.113556.1.4.803:=65536))’ -Properties useraccountcontrol,DistinguishedName,Enabled,Name

Get all enabled users where Password does not expire.

Get-ADUser -LDAPFilter ‘(&(!userAccountControl:1.2.840.113556.1.4.803:=2)(userAccountControl:1.2.840.113556.1.4.803:=65536))’ -Properties useraccountcontrol,description,DistinguishedName,Enabled,Name

Get all enabled users where Kerberos Preauthentication is disabled.

Get-ADUser -LDAPFilter ‘(&(!userAccountControl:1.2.840.113556.1.4.803:=2)(userAccountControl:1.2.840.113556.1.4.803:=4194304))’ -Properties useraccountcontrol,description,DistinguishedName,Enabled,Name

Get all enabled users where Kerberos DES encryption types are used.

Get-ADUser -LDAPFilter ‘(&(!userAccountControl:1.2.840.113556.1.4.803:=2)(userAccountControl:1.2.840.113556.1.4.803:=2097152))’ -Properties useraccountcontrol,description,DistinguishedName,Enabled,Name

Get all enabled users where Password is not required.

Get-ADUser -LDAPFilter ‘(&(!userAccountControl:1.2.840.113556.1.4.803:=2)(userAccountControl:1.2.840.113556.1.4.803:=32))’ -Properties useraccountcontrol,description,DistinguishedName,Enabled,Name

Get all enabled computers where Password is not required.

Get-ADcomputer -LDAPFilter ‘(&(!userAccountControl:1.2.840.113556.1.4.803:=2)(userAccountControl:1.2.840.113556.1.4.803:=32))’ -Properties useraccountcontrol,description,DistinguishedName,Enabled,Name

 

 

Leave a Reply