title: Invoking a PowerShell script from Python
body: <p>I'm trying to start a PowerShell script from python like this:</p>
  
  <pre><code>psxmlgen = subprocess.Popen([r'C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe',
                               './buildxml.ps1',
                               arg1, arg2, arg3], cwd=os.getcwd())
  result = psxmlgen.wait()
  </code></pre>
  
  <p>The problem is that I get the following error:</p>
  
  <blockquote>
    <p>File
    C:\Users\sztomi\workspace\myproject\buildxml.ps1
    cannot be loaded because the execution of scripts is disabled on this
    system. Please see "get-help about_signing" for more details.</p>
  </blockquote>
  
  <p>DESPITE the fact that I did enable running scripts in Powershell a long time ago by typing <code>Set-ExecutionPolicy Unrestriced</code> in an administrator-ran PS terminal (and did again, just to make sure). The powershell executable is the same that the shortcut in start menu points to. <code>Get-ExecutionPolicy</code> correctly reports <code>Unrestricted</code> no matter if I ran PowerShell as admin or not.</p>
  
  <p>How can I execute a PS script correctly from Python?</p>