Executing .exe on a remote Windows machine

Tim Golden mail at timgolden.me.uk
Thu Nov 8 17:21:40 CET 2012


On 08/11/2012 15:37, Kevin Holleran wrote:
> [code]
> try:
>             print("Attempting to restart Splunk...")
>             subprocess.call(["psexec", "\\\\" + host, "'c:\\Program
> Files\\Splunk\\bin\\splunk.exe'", "restart"])
> [/code]
> 
> & am getting:
> 
> [output]
> Attempting to restart Splunk...
> 
> PsExec v1.98 - Execute processes remotely
> Copyright (C) 2001-2010 Mark Russinovich
> Sysinternals - www.sysinternals.com <http://www.sysinternals.com>
> 
> 
> PsExec could not start 'c:\Program Files\Splunk\bin\splunk.exe' restart
> on [IP_ADDRESS]:
> The filename, directory name, or volume label syntax is incorrect.
> [/output]
> 
> I am simply trying to restart the splunk forwarder instance....
> 
> Any thoughts??

Lose the nested quotes in the .exe path; subprocess will take care of that:

subprocess.call(["psexec", "\\\\" + host, "c:\\Program
Files\\Splunk\\bin\\splunk.exe", "restart"])


TJG


More information about the Python-list mailing list