Trying to run a PowerShell script using WinRM
# $cred is valid and works for common PowerShell cmdlets
script = """
Start-Process ping.exe -Credential $cred -NoNewWindow -Wait -RedirectStandardOutput out.txt
Get-Content out.txt
"""
session = winrm.Session(host, auth=(user,passwd), transport="credssp')
result = s.run_ps(script)
If -Credentials is not used, the output is returned.
Otherwise, this creates an empty out.txt file. How do I redirect the output to out.txt/stdout?