pywinrm
pywinrm copied to clipboard
PowerShell Write-Verbose, Progress, Information, Warning cause error output
Only Write-Error is currently handled by pywinrm. Any other of the other PowerShell streams will output CLIXML and end up in Response.stderr.
I have created a PR that fixes this. It parses CLIXML and will put Warning, Verbose into Response.warning and Response.verbose. Information messages already come in to stdout, BUT they also are in the CLIXML so must be ignored to avoid Response.stderr output. Progress messages also are in CLIXML, but I ignore them.
+1 we're having similar issues and would like to see this fixed
+1 winrm.Session.run_ps() returns all other streams besides output to stderr. winrm only seems to process error stream into human-readable, all other streams are still marked up, causes headaches for client applications that check Response.std_err for any non-zero to indicate failure.
Bump
For me adding this fixed the issue. I added this line at beginning of every command I run using Session.run_ps
$ProgressPreference = "SilentlyContinue"