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.
May 12, 2005
Using only standard commands, I have scripted EnumLclGrp.bat to output local group membership.The syntax for using EnumLclGrp.bat is:
EnumLclGrp
The output is displayed on the console, but can be redirected to a file using EnumLclGrp>fileName or EnumLclGrp>>fileName.
Each line of output contains:
"Computer Name","Local Group Name","User Name"
EnumLclGrp.bat contains:
@echo offsetlocal ENABLEDELAYEDEXPANSIONfor /f "Tokens=*" %%a in ('net localgroup^|findstr /b /l /c:"*"') do ( set wrk=%%a set grp=!wrk:~1! for /f "Skip=6 Tokens=*" %%b in ('net localgroup "!grp!"^|find /I /V "The command completed successfully."') do ( @echo "%ComputerName%","!grp!","%%b" ))endlocal
You May Also Like