I seem to be having a terrible time trying to get Psexec to work correctly.
I am running this from a user with administrator rights and I am running this as administrator.
this is my complete script:
Code: Select all
@Echo On
for /f "delims=[] tokens=2" %%a in ('ping -4 -n 1 %ComputerName% ^| findstr [') do set NetworkIP=%%a
(
echo: @Echo On
echo: If not exist "C:\Dnload\9xAddons\Macrium" md "C:\Dnload\9xAddons\Macrium"
echo: cd "C:\Dnload\9xAddons\Macrium"
echo: xcopy /y /f "\\%NetworkIP%\Dnload\9xAddons\Macrium\ReflectDLHF.exe"
echo: xcopy /y /f "\\%NetworkIP%\Dnload\9xAddons\Macrium\UpdateMacrium.exe"
Echo: tasklist /fi "imagename eq UpdateMacrium.exe" 2>NUL | find /I /N "no tasks are running">NUL
Echo: if "%errorlevel%"=="0" ^(
Echo: echo Task Found
Echo: taskkill /f /im UpdateMacrium.exe
Echo: ^)
Echo: tasklist /fi "imagename eq ReflectDLHF.exe" 2>NUL | find /I /N "no tasks are running">NUL
Echo: if "%errorlevel%"=="0" ^(
Echo: echo Task Found
Echo: taskkill /f /im ReflectDLHF.exe
Echo: ^)
Echo: Call UpdateMacrium.exe
) > %~dp0UpdateMacriumRun.bat
c:\batch\psexec.exe @"C:\Batch\PushFileAndRunItComputerList.txt" -u MyUser -p MyPassword -i -c -v "C:\Dnload\9xAddons\Macrium\UpdateMacriumRun.bat"
This bat file creates another bat file with the correct IP address of the PC I run the bat file from.
Then Psexec sends the bat file that was created UpdateMacriumRun.bat to another PC on my LAN.
On the other PC a cmd window comes up with a cmd prompt. The files do get copied. I expect the Call UpdateMacrium.exe to run.
If I run this bat file on the target PC, it runs fine.
I figured out the problem. I needed to add the -i to the Psexec cmd line.
It's running now.
Thanks,
Docfxit