Skip to content

Instantly share code, notes, and snippets.

@santisq
Last active February 28, 2025 17:32
Show Gist options
  • Save santisq/d47d45368d7a5b3649bc291c91e1c39b to your computer and use it in GitHub Desktop.
Save santisq/d47d45368d7a5b3649bc291c91e1c39b to your computer and use it in GitHub Desktop.
Translates userAccountControl Value to UserAccountControl Flag
[Flags()] enum UAC {
SCRIPT = 1
ACCOUNTDISABLE = 2
HOMEDIR_REQUIRED = 8
LOCKOUT = 16
PASSWD_NOTREQD = 32
PASSWD_CANT_CHANGE = 64
ENCRYPTED_TEXT_PWD_ALLOWED = 128
TEMP_DUPLICATE_ACCOUNT = 256
NORMAL_ACCOUNT = 512
INTERDOMAIN_TRUST_ACCOUNT = 2048
WORKSTATION_TRUST_ACCOUNT = 4096
SERVER_TRUST_ACCOUNT = 8192
DONT_EXPIRE_PASSWORD = 65536
MNS_LOGON_ACCOUNT = 131072
SMARTCARD_REQUIRED = 262144
TRUSTED_FOR_DELEGATION = 524288
NOT_DELEGATED = 1048576
USE_DES_KEY_ONLY = 2097152
DONT_REQ_PREAUTH = 4194304
PASSWORD_EXPIRED = 8388608
TRUSTED_TO_AUTH_FOR_DELEGATION = 16777216
PARTIAL_SECRETS_ACCOUNT = 67108864
}
Get-ADUser -Filter * -Properties userAccountControl |
Select-Object Name, userAccountControl, @{ N='Value'; E={ $_.userAccountControl -as [UAC] }} -First 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment