Set 'InputFile' variable with a file name with path from where it will pick computer names.
This file should contain computer name on each line, like:
PC1
PC2
PC3
Set "OutputFile" variable with a file name including path where it will store the results.
So here you go...
:: SCRIPT START::
@ECHO OFF
SET InputFile=C:\Computers.txt
SET OutputFile=C:\IEInfo.txt
IF NOT EXIST "%InputFile%" ECHO **ERROR** "%InputFile%" file does not exist. &GOTO :ExitScript
FOR %%R IN ("%InputFile%") DO IF %%~zR EQU 0 ECHO **ERROR** "%InputFile%" file is empty! &GOTO :ExitScript
FOR /F "delims=" %%C IN ('TYPE "%InputFile%"') Do (
PING -n 1 -l 10 -w 100 %%C |FIND /I "TTL" >NUL
IF NOT ERRORLEVEL 1 (
ECHO Processing: %%C
FOR /F "tokens=3" %%v IN ('REG QUERY "\\%%C\HKLM\SOFTWARE\Microsoft\Internet Explorer" /v Version ^|FIND /I "REG_SZ"') DO (
ECHO Computer: %%C IE Version: %%v>>"%OutputFile%"))ELSE (ECHO **ERROR** Unable to connect %%C))
ECHO. &ECHO Script finish, check "%OutputFile%" file for result.
:ExitScript
ECHO.
PAUSE
SET InputFile=C:\Computers.txt
SET OutputFile=C:\IEInfo.txt
IF NOT EXIST "%InputFile%" ECHO **ERROR** "%InputFile%" file does not exist. &GOTO :ExitScript
FOR %%R IN ("%InputFile%") DO IF %%~zR EQU 0 ECHO **ERROR** "%InputFile%" file is empty! &GOTO :ExitScript
FOR /F "delims=" %%C IN ('TYPE "%InputFile%"') Do (
PING -n 1 -l 10 -w 100 %%C |FIND /I "TTL" >NUL
IF NOT ERRORLEVEL 1 (
ECHO Processing: %%C
FOR /F "tokens=3" %%v IN ('REG QUERY "\\%%C\HKLM\SOFTWARE\Microsoft\Internet Explorer" /v Version ^|FIND /I "REG_SZ"') DO (
ECHO Computer: %%C IE Version: %%v>>"%OutputFile%"))ELSE (ECHO **ERROR** Unable to connect %%C))
ECHO. &ECHO Script finish, check "%OutputFile%" file for result.
:ExitScript
ECHO.
PAUSE
:: SCRIPT END::
No comments:
Post a Comment