| Total Complexity | 2 |
| Total Lines | 24 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | from pywinexe.api import cmd as run_cmd |
||
| 10 | class SetupWinRMAction(Action): |
||
| 11 | def run(self, host, password, username='Administrator'): |
||
| 12 | """ |
||
| 13 | Setup WinRM on a remote node to accept non-cert trusted connections |
||
| 14 | """ |
||
| 15 | out = run_cmd( |
||
| 16 | 'echo hello', |
||
| 17 | args=[], |
||
| 18 | user=username, |
||
| 19 | password=password, |
||
| 20 | host=host) |
||
| 21 | cmds = [ |
||
| 22 | "winrm quickconfig -quiet", |
||
| 23 | "winrm set winrm/config/service/auth @{Basic=\"true\"}",
|
||
| 24 | "winrm set winrm/config/service @{AllowUnencrypted=\"true\"}"
|
||
| 25 | ] |
||
| 26 | out = [ |
||
| 27 | run_cmd( |
||
| 28 | cmd, |
||
| 29 | args=[], |
||
| 30 | user=username, |
||
| 31 | password=password, |
||
| 32 | host=host) for cmd in cmds] |
||
| 33 | return out |
||
| 34 |