I have been succesful at using PSEXEC to fire off a VBScript on a remote server, but I am running into problems with a different script executing on another Domain PC.
Here is the BATCH file that works perfectly:
LogMerge.bat: (The .VBS was already on the destination Host as I know the limitation of using PSEXEC with cscript)
echo Merging logs, please wait...
start /wait psexec.exe \\XXnameXX -c -f cscript.exe "\\XXnameXX\d$\department\Support\LogMerge.vbs"
Now, I am trying to run a different script which will be copied too and fired off on a list of remote domain PC's on our network. This is what it looks like:
echo Uninstalling Timeclock Pro version 5.6, please wait...
For /F %%a in (c:\PsTools\tcWork\Host5.txt) do (
xcopy /d/y/s "C:\PsTools\tcWork\RemShort.vbs" "\\%%a\c$\temp\"
rem xcopy /d/y/s "C:\PsTools\tcWork\RemShort.bat" "\\%%a\c$\temp\"
rem start /wait psexec.exe @Host5.txt -s -c -f -w c:\temp tcRemove2.bat
rem start /wait psexec.exe @Host5.txt -s -c -f -w c:\temp tcCleanup.bat
rem start /wait psexec.exe @Host5.txt -s -c -f -w c:\temp RemShort.bat
start /wait psexec.exe @Host5.txt -s -c -f cscript.exe c:\temp\RemShort.vbs
rem for /F %%a in (c:\PsTools\tcWork\Host5.txt) do (
rem xcopy /d/y/s "\\%%a\c$\tclogs\*.log" "\\XXnameXX\d$\department\Support\logs\"
For testing purposes I REM'd all the lines that I know already work and do not want running while I'l troubleshooting the 'RemShort.vbs' script issue. Using the above batch file, the process runs and I get that the process exited with error 0, which typically means it worked, but the thing is it didn't work. It's supposed to remove a short cut from all user profile's Desktop. If I run the script locally on the same host PC, it works like a charm. For troubleshooting purposes, I added the above REM'd lines that instead of trying to call the VBS directly using cscript, I copy a RemShort.BAT over and then call the batch so it will execute the cscript command locally to that PC. I get the same 'exited with error 0' display and nothing happens. I can run the same batch locally by clicking on it and it does what it's supposed to do. I can't figure out why this particular script just does not want to be run remotely, when the 1st script I listed works perfectly fine remotely.
Let me know if ya'll need to see the scripts themselves. I was not sure if the actual script code was relevant. They both work like a charm only the RemShort.vbs has issues with remote execution.
Thanks in advance for your help,