You can use this to remotely run a script on a list of computers, which can install EXE apps, launch MSI setups, or execute scripted commands. It does use PSEXEC (or paexec).
Contents of _Script_Engine.cmd
:: ************************************************************************** :: Script Language: Shell :: Script Name: _Script_Engine.cmd :: Purpose: To be used to run a script — to install MSI :: Creation Date: 08/14/2016 :: Last Modified: :: Directions: add computer names to computers.txt file :: double-click the _Script_Engine.cmd :: Author: Eddie Jackson :: Email: MrNetTek2000@yahoo.com :: ************************************************************************** @echo off color 0a @title Script Engine set CurDir=%cd% setLocal EnableDelayedExpansion REM ENTER NAME OF COMPUTER TEXT FILE Set PCList=computers.txt REM CREATES DATE AND TIME TIMESTAMP rem sets a static timestamp for /F “tokens=2-4 delims=/- ” %%p in (‘date/T’) do set mdate=%%r%%p%%q for /F “tokens=1-2 delims=:- ” %%p in (‘time/T’) do set mtime=%%p%%q Set ReportN=%mdate%_%mtime%.txt for /f “tokens=* delims= ” %%a in (%PCList%) do ( REM TIMESTAMP FOR /F “TOKENS=*” %%B IN (‘DATE/T’) DO SET NowD=%%B FOR /F “TOKENS=*” %%A IN (‘TIME/T’) DO SET NowT=%%A REM VERIFY IF MACHINE IS ONLINE cls echo Workstation being tested: %%a c:\windows\System32\ping.exe %%a | find “Reply” > nul if errorlevel 1 (echo !NowD! !NowT!, %%a, OFFLINE >> “logs\%ReportN%” & echo %%a OFFLINE & echo. ) else ( REM COPY FILES TO REMOTE COMPUTER cls echo Copying files to client… copy /y /v “%CurDir%\sequence.cmd” \\%%a\c$\windows\system32 copy /y /v “%CurDir%\Setup.MSI” \\%%a\c$\windows\system32 ping.exe -n 4 127.0.0.1>nul REM LAUNCH SEQUENCE.CMD ON REMOTE COMPUTER cls echo Installing MSI on %%a… “%CurDir%\psexec.exe” /accepteula \\%%a sequence.cmd echo !NowD! !NowT!, %%a, ONLINE >> “logs\%ReportN%” & echo %%a ONLINE & echo. ) ) pause exit /b 0
Contents of sequence.cmd
@echo off title Remote Install cls Echo Installing MSI… c:\windows\system32\Setup.MSI /QN /NORESTART exit /b 0
References