I want to execute powershell command remotely and fetch the output. The command is "(New-Object -c Microsoft.Update.Session).CreateUpdateSearcher().Search("IsInstalled=0").Updates|Select Title". I have tried import wmi try: connection = wmi.WMI(ip, user=username, password=password) print("connection is established") connection.Win32_Process.Create(CommandLine='powershell.exe /c (New-Object -c Microsoft.Update.Session).CreateUpdateSearcher().Search("IsInstalled=0").Updates|Select Title > C:\output.txt') except: print("connection failed") Continue reading...