Subscribe to Windows IT Pro

 

Get Newsletters

  • Get the Latest News
  • Product Updates
  • Helpful Tricks
  • Productivity Tips

Subscribe Now!

May 25, 2004 12:00 AM

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

Windows IT Pro
InstantDoc ID #80951
Rating: (1)


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 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%



Related Content:

ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

White Papers

Get your Windows 7 deployment off to the right start by implementing PC lockdown. A locked-down environment is easier and cheaper to support since users are less likely to make unnecessary changes to the core system configuration - read more here!

Essential Guides

Is your iSCSI "lossy"? The reality is that most off-the-shelf Ethernet hardware deployed for iSCSI can lose packets, resulting in slow performance or application downtime. Learn how to assess your current iSCSI infrastructure and engineer an advanced iSCSI SAN infrastructure.

Web Seminars

What's the best way to keep your network safe from malware? In this web seminar, security expert Greg Shields suggests an alternative method to the traditional blacklisting approach that is common with anti-virus and anti-malware solutions.

eLearning Series

We bring the experts direct to you to share their real-world perspective and expertise. During each event, three sessions stream in real time, so you can learn, ask questions, and get solutions.
Upcoming event: Getting the Most with Exchange 2010 with Paul Robichaux

Subscribe to Windows IT Pro!

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.