Page 1 of 1
[RESOLVED] run remote commands
Published: March 22, 2018 - 1:24 PM
by empbilly
Hello,
I searched and did not find a specific command to remotely run a command.
Is there anything for that?
I tried the following way. I need to run remotely, for example, the command "wapt-get generate-uuid".
I tried as follows, but gave error.
Code: Select all
# -*- coding: utf-8 -*-
from setuphelpers import *
uninstallkey = []
def install():
print('executing remote command')
run(r'c:\windows\system32\cmd.exe /c wapt-get generete-uuid')
Re: Run remote commands
Published: March 22, 2018 - 2:01 PM
by sfonteneau
Re: Run remote commands
Published: March 22, 2018 - 2:16 PM
by empbilly
wow!! Thanks sfonteneau!!! Works like a charm!!
Re: Run remote commands
Published: March 23, 2018 - 9:27 PM
by empbilly
sfonteneau,
Regarding my example,
Code: Select all
run(r'c:\windows\system32\cmd.exe /c wapt-get generete-uuid')
Would this work via WAPT?
Re: Run remote commands
Published: March 24, 2018 - 00:26
by htouvet
Theoretically,
would be enough as the run command starts a sub shell (cmd) by default.
generate-uuid could eventually work but a lot of other "wapt-get" would not work properly because only one wapt process must be running at a time (and the waptservice is a wapt process).
And if you can do what you need directly using python, you have more control to handle the exceptions (try: except: try finally: etc..) as you would have with a cmd shell
Re: Run remote commands
Published: March 26, 2018 - 2:41 PM
by empbilly
htouvet wrote: ↑March 24, 2018 - 00:26
Theoretically,
would be enough as the run command starts a sub shell (cmd) by default.
generate-uuid could eventually work but a lot of other "wapt-get" would not work properly because only one wapt process must be running at a time (and the waptservice is a wapt process).
And if you can do what you need directly using python, you have more control to handle the exceptions (try: except: try finally: etc..) as you would have with a cmd shell
hello htouvet,
Using python directly does it need the target machine to have python installed or wapt client take care of it? Need execution with administrative rights?
Re: Run remote commands
Published: March 26, 2018 - 7:35 PM
by dcardon
Hi Empbilly,
empbilly wrote: ↑March 26, 2018 - 2:41 p.m.
Using python directly does it need the target machine to have python installed or wapt client take care of it? Need execution with administrative rights?
wapt come with its own python 2.7 interpreter. It is located in the base directory of the wapt installation, normally c:\program files (x86)\wapt\waptpython.exe . You can add your own python interpreter if you really need it.
Cheers,
Denis
Re: Run remote commands
Published: March 26, 2018 - 9:30 PM
by empbilly
The answer is in the topic of the link below.
viewtopic.php?f=10&t=1083