In tip 9610, I scripted MbrShp.bat to return the groups in the logged on user's security token.

If you are running Windows XP, the WhoAmi.exe program from the Support Tools on the operating system CD-ROM, can be used to script MbrShp.bat:

@echo off
for /f "Tokens=2* Delims<h1><a name="_a_in_whoami_groups_find_v_LOCAL_do_echo_b_pre_When_I_ran_the_b_WhoAmi_exe_b_from_my_Windows_Server_2003_b_SP1_b_the_output_looked_like_pre_font_size_1_GROUP_INFORMATION_Group_Name_Type_SID_Attributes_"> " %%a in ('whoami /groups ^|find /v "LOCAL"') do (
 @echo %%b
)
</a></h1>
When I ran the WhoAmi.exe from my Windows Server 2003 SP1, the output looked like:
<font size="1">GROUP INFORMATION
-----------------

Group Name                       Type             SID                                           Attributes

=========================<h4><a name="_"> </a></h4>======<h4><a name="_"> </a></h4>===================================<h4><a name="_"> </a></h4>=====================================================<h4><a name="_JSIINC_Domain_Admins_Group_S_1_5_21_4696543212_689049625_1231234552_512_Mandatory_group_Enabled_by_default_Enabled_group_font_pre_To_use_this_version_I_needed_a_href_article_jsifaq_jsi_tip_9470_a_better_way_to_determine_the_length_of_a_string_aspx_b_VLen_bat_b_a_in_my_b_MbrShp_bat_b_pre_echo_off_setlocal_enabledelayedexpansion_If_not_all_domain_controllers_are_runningt_W2K3_change_LOGONSERVER_to_ServerName_for_f_Tokens_1_a_in_LOGONSERVER_ADMIN_System32_Whoami_exe_groups_find_">
JSIINC\Domain Admins             Group            S-1-5-21-4696543212-689049625-1231234552-512  Mandatory group, Enabled by default, Enabled group</a></h4></font>
To use this version, I needed VLen.bat in my MbrShp.bat:
@echo off
setlocal enabledelayedexpansion
:: If not all domain controllers are runningt W2K3, change %LOGONSERVER% to \\ServerName
for /f "Tokens=1" %%a in ('%LOGONSERVER%\ADMIN$\System32\Whoami.exe /groups^|find "="') do set slength=%%a
call vlen "%slength%" len
for /f "Skip=6 Tokens=*" %%a in ('%LOGONSERVER%\ADMIN$\System32\Whoami.exe /groups^|find /v "LOCAL"') do (
 set line=%%a
 call set grp=!line:~0^,%len%!
 set grp="!grp:  =!"
 set grp=!grp: "="!
 @echo !grp!
)
endlocal