when the script is running, when it finds a machine to be unreachable I want it to skip it. and do psexec command for the online PCs only
i created a bat file as below but it's not working
@echo off
setlocal
:begin
for /f %%a in (computerlist.txt) do (
ping -n 1 %%a >NUL 2>NUL
if %errorlevel%==0 (
psexec \\%%a -u user -p password -i -d "d:\path\command.exe"
) else echo Skipping unreachable host %%a
)
endlocal