Experts Exchange connects you with the people and services you need so you can get back to work.
Improve company productivity with a Business Account.Sign Up
REM Define files to be used
REM Capture all output to a log file
REM Read each server name from the file
for /F "usebackq tokens=* delims=" %%A in ("%ServerList%") do (
REM Do a basic ping to server to make sure it responds
ping -n 1 -w 250 %%A >nul 2>nul && (
REM Use WMI to get the architecture of the remote server
for /F "tokens=2 delims=, skip=1" %B in ('wmic os get osarchitecture^,version /format:csv') do (
REM Use different command on 64 versus 32 bit OS
if "%%B" == "64-bit" (
psexec \\%%A c:\windows\temp\myexecutable64.exe /q
) else (
psexec \\%%A c:\windows\temp\myexecutable32.exe /q
) || (
REM Ping failed, log as unreachable
echo Server [%%A] not reachable
) >"%LogFile% 2>&1"
Open in new window
WatchGuard DNSWatch reduces malware infections by detecting and blocking malicious DNS requests, improving your ability to protect employees from phishing attacks. Learn more about our newest service included in Total Security Suite today!
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.