Using GetUsers.bat, I have scripted UsrGroups.bat to
report all user's local and global group membership.
When you run UsrGroups, the output is displayed on the console, but you can pipe it to a file using:
UsrGroups>FileName
UsrGroups.bat contains:
@echo off setlocal set space= # set space=%Space:~0,26% for /f "Tokens=*" %%u in ('getusers') do ( set user=%%u set OK=N for /f "Skip= 24 Tokens=*" %%g in ('net user "%%u" /domain^|Findstr /l /n /v /c:"*$"') do ( set line=%%g call :group ) ) endlocal goto :EOF :group if /i "%line:~3,34%" EQU "The command completed successfully" @echo\ &goto :EOF if "%OK%" EQU "Y" goto Group2 if /i "%line:~3,11%" EQU "Local Group" goto Group1 if /i "%line:~3,12%" EQU "Global Group" goto Group1 goto :EOF :Group1 set OK=Y set usr=%user% # set usr=%usr:~0,26% set line=%line:~3% @echo %usr%%line% goto :EOF :Group2 set line=%line:~3% if "%line%" EQU "" goto :EOF @echo %space%%line%
0 comments
Hide comments