JSI Tip 8072. How can I decode the sAMAccountType attribute?

Jerold Schulman

May 24, 2004

1 Min Read
ITPro Today logo in a gray background | ITPro Today


When you user the DSQUERY command to return the sAMAccountType attribute, it is returned as a numeric value.

I have scripted sAMAccountType.bat to translate this value.

The syntax for using sAMAccountType.bat is:

call sAMAccountType sat satDescription

Where sat is the numeric value of the sAMAccountType attribute, and satDescription is a call directed environment variable that will contain the description of the object.

sAMAccountType.bat contains:

@echo offif {%2}=={} @echo Syntax: call sAMAccountType sat satDescription&goto :EOFif "%1" EQU "0" set %2=SAM_DOMAIN_OBJECT&goto :EOFsetlocalset /a sat=%1set desc=UNKNOWNif %sat% EQU 268435456 set desc=SAM_GROUP_OBJECT&goto finishif %sat% EQU 268435457 set desc=SAM_NON_SECURITY_GROUP_OBJECT&goto finishif %sat% EQU 536870912 set desc=SAM_ALIAS_OBJECT&goto finishif %sat% EQU 536870913 set desc=SAM_NON_SECURITY_ALIAS_OBJECT&goto finishif %sat% EQU 805306368 set desc=SAM_NORMAL_USER_ACCOUNT&goto finishif %sat% EQU 805306369 set desc=SAM_MACHINE_ACCOUNT&goto finishif %sat% EQU 805306370 set desc=SAM_TRUST_ACCOUNT&goto finishif %sat% EQU 1073741824 set desc=SAM_APP_BASIC_GROUP&goto finishif %sat% EQU 1073741825 set desc=SAM_APP_QUERY_GROUP&goto finishif %sat% EQU 2147483647 set desc=SAM_ACCOUNT_TYPE_MAX:finishendlocal&set %2=%desc%



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like