Executing .exe on a remote Windows machine
Kevin Holleran
kdawg44 at gmail.com
Thu Nov 8 11:40:50 EST 2012
More information about the Python-list mailing list
Thu Nov 8 11:40:50 EST 2012
- Previous message (by thread): Executing .exe on a remote Windows machine
- Next message (by thread): int.__init__ incompatible in Python 3.3
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Nov 8, 2012 at 11:32 AM, Chris Rebert <clp2 at rebertia.com> wrote: > On Thursday, November 8, 2012, Kevin Holleran wrote: > >> On Thu, Nov 8, 2012 at 9:43 AM, Kevin Holleran <kdawg44 at gmail.com> wrote: >> >>> My goodness.... psexec. >>> >>> thanks.... can't believe that didn't come to me... >>> >>> >>> >>> >>> On Thu, Nov 8, 2012 at 9:31 AM, Tim Golden <mail at timgolden.me.uk> wrote: >>> >>>> On 08/11/2012 14:25, Kevin Holleran wrote: >>>> > Good morning, >>>> > >>>> > I wrote a python script to connect out to a bunch of my remote >>>> machines >>>> > that are running some software. It modifies a bunch of the config >>>> files >>>> > for me. After making the changes, I need to restart the software. >>>> The >>>> > way to do this is to call an .exe passing in a argument 'restart' >>>> > Simply restarting services is NOT acceptable & rebooting the machine >>>> > isn't either. >>>> > >>>> > I was trying to find a way to simply call the .exe on the remote >>>> machine >>>> > with subprocess but how can I get it to execute on the remote machine? >>>> > These machines do not have SSH. >>>> >>>> WMI can usually help with this (although there are limitations on what >>>> you can execute via WMI). Also people recommend sysinternals' psexec. >>>> (I've never tried it myself). >>>> >>>> TJG >>>> -- >>>> http://mail.python.org/mailman/listinfo/python-list >>>> >>> >>> >> >> OK, not quite resolved yet.... >> >> My code.... >> >> [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 >> >> >> 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?? >> > > Remove the apostrophes surrounding the path to Splunk's executable. The > subprocess module already takes care of the quoting for you, so the > apostrophes are unnecessary and are being interpreted literally. > > > -- > Cheers, > Chris > -- > http://rebertia.com > Thanks Tim & Chris... you guys are my heroes for today.... :) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-list/attachments/20121108/6951f575/attachment.html>
- Previous message (by thread): Executing .exe on a remote Windows machine
- Next message (by thread): int.__init__ incompatible in Python 3.3
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list