I have a .Bat file for testing that will kill my Chrome browser:
@cls
@echo You are about to kill Chrome
tskill "chrome"
It works fine when invoked locally. Chrome dies. If I invoke that exact .Bat file from another machine via psexec (of PsTools):
psexec 10.60.90.10 -u admin -p pizza1234 "C:/myBatfile.bat"
I get an error, saying:
Could not find process: chrome
Any idea why invoking that .bat file remotely would cause this error? The “local” machine is Windows Server 2008, the remote (“invoking”) machine is Windows 7.
—SOLUTION—
The /A flag looks through all sessions. Thanks for your help.
tskill "chrome" /A
Psexec utilizes a service on the target machine to execute the command. Services live in a separate Windows session than the interactive session where your chrome process is running. When executing through psexec, the bat file will search the service session for a chrome.exe process and there is none.