Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
tutorial:adm:configuration_-_winrm [2019/10/08 12:18]
fiserp [Debug]
tutorial:adm:configuration_-_winrm [2019/10/08 13:17]
fiserp [Debug]
Line 97: Line 97:
 Next we want to try to connect to WinRM. Install [[devel:documentation:systems:dev:winrm_connector#installation|pywinrm]] follow only the first part of installation, we don't need to install connector server. Next we want to try to connect to WinRM. Install [[devel:documentation:systems:dev:winrm_connector#installation|pywinrm]] follow only the first part of installation, we don't need to install connector server.
 Open terminal (Linux) or powershell (Windows) Open terminal (Linux) or powershell (Windows)
-<code>+<code python>
 > python > python
 >>> import winrm >>> import winrm
Line 105: Line 105:
 </code> </code>
 For connecting via HTTPS use this lane. The difference is in URL where we need to use https and port 5986. Then we are using one more argument where we specify path to trust store For connecting via HTTPS use this lane. The difference is in URL where we need to use https and port 5986. Then we are using one more argument where we specify path to trust store
-<code>+<code python>
 >>> s = winrm.Session('https://HOST:5986/wsman', auth=(HOST, PASS), transport='ntlm', ca_trust_path='/etc/ssl/certs/CRT.pem') >>> s = winrm.Session('https://HOST:5986/wsman', auth=(HOST, PASS), transport='ntlm', ca_trust_path='/etc/ssl/certs/CRT.pem')
 </code> </code>
-After executing "r" you should see this: 
-{{:tutorial:adm:winrm_response.png?nolink&400|}} 
  
-Now what we did here? We connect to WinRM via ntlm and executed command Write-Host which is just basic output to console. If there is some misconfiguration in Windows server you will probably get error after executing line +Then, execute the winrm call. Followin call simply instructs the remote powershell to echo "connection test OK". If there some errors or warnings during the call, the python REPL will display them.
 <code>r = s.run_ps('Write-Host connection test OK')</code> <code>r = s.run_ps('Write-Host connection test OK')</code>
 +
 +The fact that there were some stacktraces printed does not necessarily mean the call failed.
 +
 +Now simply print the result by calling ''r''. After executing ''r''you should see something like this (note the "connection test OK" string is there):
 +{{:tutorial:adm:winrm_response.png?nolink&400|}}
 +
 +
  
 === Commons errors === === Commons errors ===
  • by erbenr