This PowerShell script will enumerate all user accounts in a Domain, calculate their UserAccountControl flags and create a report of the “interesting” flags in CSV format.
The interesting flags are those you are interested in reporting on as documented in Microsoft KB305144 such as:
- SCRIPT
- ACCOUNTDISABLE
- HOMEDIR_REQUIRED
- LOCKOUT
- PASSWD_NOTREQD
- PASSWD_CANT_CHANGE
- ENCRYPTED_TEXT_PWD_ALLOWED
- TEMP_DUPLICATE_ACCOUNT
- NORMAL_ACCOUNT
- INTERDOMAIN_TRUST_ACCOUNT
- WORKSTATION_TRUST_ACCOUNT
- SERVER_TRUST_ACCOUNT
- DONT_EXPIRE_PASSWORD
- MNS_LOGON_ACCOUNT
- SMARTCARD_REQUIRED
- TRUSTED_FOR_DELEGATION
- NOT_DELEGATED
- USE_DES_KEY_ONLY
- DONT_REQ_PREAUTH
- PASSWORD_EXPIRED
- TRUSTED_TO_AUTH_FOR_DELEGATION
- PARTIAL_SECRETS_ACCOUNT