Skip to content

Instantly share code, notes, and snippets.

@ubergoober
Created May 7, 2014 18:28
Show Gist options
  • Select an option

  • Save ubergoober/1616beabaf6f141bd4b2 to your computer and use it in GitHub Desktop.

Select an option

Save ubergoober/1616beabaf6f141bd4b2 to your computer and use it in GitHub Desktop.
AD Account Types
@echo off
if {%2}=={} @echo Syntax: call sAMAccountType sat satDescription&goto :EOF
if "%1" EQU "0" set %2=SAM_DOMAIN_OBJECT&goto :EOF
setlocal
set /a sat=%1
set desc=UNKNOWN
if %sat% EQU 268435456 set desc=SAM_GROUP_OBJECT&goto finish
if %sat% EQU 268435457 set desc=SAM_NON_SECURITY_GROUP_OBJECT&goto finish
if %sat% EQU 536870912 set desc=SAM_ALIAS_OBJECT&goto finish
if %sat% EQU 536870913 set desc=SAM_NON_SECURITY_ALIAS_OBJECT&goto finish
if %sat% EQU 805306368 set desc=SAM_NORMAL_USER_ACCOUNT&goto finish
if %sat% EQU 805306369 set desc=SAM_MACHINE_ACCOUNT&goto finish
if %sat% EQU 805306370 set desc=SAM_TRUST_ACCOUNT&goto finish
if %sat% EQU 1073741824 set desc=SAM_APP_BASIC_GROUP&goto finish
if %sat% EQU 1073741825 set desc=SAM_APP_QUERY_GROUP&goto finish
if %sat% EQU 2147483647 set desc=SAM_ACCOUNT_TYPE_MAX
:finish
endlocal&set %2=%desc%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment