title: Unable to get the output from a powershell command using python script
body: <p>I have a powershell command with an OutFile. It is working perfectly fine when I am running directly from the powershell console. It is capturing the output in a text file.
  But when I am trying to run the same command using a python script, it is not giving any error, but it is generating an empty text file. Can I get a solution to this problem.
  I am using subprocess method.</p>
  <p>the code is like this:</p>
  <pre class="lang-py prettyprint-override"><code>import subprocess,;
  process=subprocess.run([&quot;powershell&quot;, &quot;-ExecutionPolicy&quot;, &quot;Unrestricted&quot;, &quot;&lt;Powershell command&gt; | Out-File C:\PythonScripts\out.txt&quot;],stdout=subprocess.PIPE, text=True);
  print(process.stdout)
  </code></pre>