Friday, 3 January 2020

CMD - install software on remote computer with wmic


@echo off

set LISTFILE=computers.txt

for /f %%a in (%LISTFILE%) do (
echo.
echo ---------------------------------------
echo.
echo %%a
ping -n 1 %%a | find "TTL="
if not errorlevel 1 (
echo copy your setup.exe to %%a
if not exist "\\%%a\c$\temp\" mkdir "\\%%a\c$\temp\"
if NOT exist "\\%%a\c$\temp\setup.exe" xcopy "C:\source-temp\setup.exe" "\\%%a\c$\temp\" /Y
wmic /Node:%%a process call create "\\%%a\c$\temp\setup.exe  /quiet /norestart"

)

)

No comments:

Post a Comment