I am fairly new to windows batch processing and have the following question for everyone.
Requirement: Call a Batch file XYZ on Remote Server A from Server B
I was able to successfully call the Batch file on the remote server using PsExec directly from CMD but when I encapsulate the PsExec command into a separate batch file and execute it, the process executes fine but it does not execute the target batch file on Remote Server A
Script which I used directly on my local CMD that executed the DEV_CACHE_UPDT.bat successfully.
Code: Select all
------------------------------------------------------------------------------------------------------------------------
C:\TEST\PsExec.exe \\REMOTE-SERVER-A -u ABC -i -d cmd /c c:\MS\UPDT.bat
....
....
....
cmd started on REMOTE-SERVER-A with process ID 1234
-------------------------------------------------------------------------------------------------------------------------
I encapsulated the above script into a batch file by itself (TEST2.bat)
Code: Select all
@ECHO ON
C:\TEST\PsExec.exe \\REMOTE-SERVER-A -u ABC -i -d cmd /c c:\MS\UPDT.bat
Called Test2.bat from CMD
Code: Select all
------------------------------------------------------------------------------------------------------------------------
C:\Batch\Test2.bat
...
...
...
...
cmd started on REMOTE-SERVER-A with process ID 6789
------------------------------------------------------------------------------------------------------------------------
The process runs fine but it does not execute the UPDT.bat in the REMOTE-SERVER-A
I am not sure why the script executes fine when applied directly on CMD but it does not pass the command to Remote Server A when PsExec is used in a Batch file.
Any ideas will be highly appreciated..
Thanks!