<div dir="ltr">On Thu, Nov 8, 2012 at 9:43 AM, Kevin Holleran <span dir="ltr"><<a href="mailto:kdawg44@gmail.com" target="_blank">kdawg44@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">My goodness.... psexec.  <div><br></div><div>
thanks.... can't believe that didn't come to me...</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div><div class="h5"><br><div class="gmail_quote">On Thu, Nov 8, 2012 at 9:31 AM, Tim Golden <span dir="ltr"><<a href="mailto:mail@timgolden.me.uk" target="_blank">mail@timgolden.me.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div>On 08/11/2012 14:25, Kevin Holleran wrote:<br>
> Good morning,<br>
><br>
> I wrote a python script to connect out to a bunch of my remote machines<br>
> that are running some software.  It modifies a bunch of the config files<br>
> for me.  After making the changes, I need to restart the software.  The<br>
> way to do this is to call an .exe passing in a argument 'restart'<br>
>  Simply restarting services is NOT acceptable & rebooting the machine<br>
> isn't either.<br>
><br>
> I was trying to find a way to simply call the .exe on the remote machine<br>
> with subprocess but how can I get it to execute on the remote machine?<br>
>  These machines do not have SSH.<br>
<br>
</div>WMI can usually help with this (although there are limitations on what<br>
you can execute via WMI). Also people recommend sysinternals' psexec.<br>
(I've never tried it myself).<br>
<br>
TJG<br>
<span><font color="#888888">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></span></blockquote></div><br></div></div></div>
</blockquote></div><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">OK, not quite resolved yet....</div><div class="gmail_extra"><br></div><div class="gmail_extra">My code....</div><div class="gmail_extra">
<br></div><div class="gmail_extra">[code]</div><div class="gmail_extra"><div class="gmail_extra">try:</div><div class="gmail_extra">            print("Attempting to restart Splunk...")</div><div class="gmail_extra">
            subprocess.call(["psexec", "\\\\" + host, "'c:\\Program Files\\Splunk\\bin\\splunk.exe'", "restart"])</div><div>[/code]</div><div><br></div><div>& am getting:</div>
<div><br></div><div>[output]</div><div><div>Attempting to restart Splunk...</div><div><br></div><div>PsExec v1.98 - Execute processes remotely</div><div>Copyright (C) 2001-2010 Mark Russinovich</div><div>Sysinternals - <a href="http://www.sysinternals.com">www.sysinternals.com</a></div>
<div><br></div><div><br></div><div>PsExec could not start 'c:\Program Files\Splunk\bin\splunk.exe' restart on [IP_ADDRESS]:</div><div>The filename, directory name, or volume label syntax is incorrect.</div></div><div>
[/output]</div><div><br></div><div>I am simply trying to restart the splunk forwarder instance....</div><div><br></div><div>Any thoughts??</div><div><br></div><div>Thanks.</div><div><br></div><div>Kevin</div></div></div>