Script to retrieve members of local administrator group from LAN computers

The script enumerates members of local administrator group of all network machines specified in clientcomputers.txt and gives output in txt/html.

Requirements for running below script:
a. Administrative privilege on all machines to be enumerated
b. RPC (Remote Procedure Call) service should be running on all machines to respond to the query.

‘Enumerating members of local administrator group in all client machines
‘WMIC script written as batch file

‘Copyright(c) 2008 SKAP
‘Version 1.0 – 24/09/2008
‘This script enumerates members of local administrator group in all client machines.
‘Create a clientcomputers.txt file containing computer names of all machines on which you want to run this script
‘The script should run with administrative privilege on all client machines listed in clientcomputers.txt
‘rename file from txt to bat file to run

‘Output file is created as text file, output.txt
‘BEGIN
echo off
for /f %%i in (clientcomputers.txt) do wmic /failfast:ON /node:%%i /append:output.txt path win32_groupuser where (groupcomponent = “win32_group.name=\”administrators\”,domain=\”%%i\””)
pause
‘END

‘Output file is created as html file, output.html
‘BEGIN
echo off
for /f %%i in (clientcomputers.txt) do wmic /failfast:ON /node:%%i /append:output.html path win32_groupuser where (groupcomponent = “win32_group.name=\”administrators\”,domain=\”%%i\””) get /format:htable.xsl
pause
‘END

Leave a Reply