title: Is there a way to run powershell code in python
body: <p>Is there a way to run powershell code in python? I've been searching around and all I'm finding is how to run a separate PS script file in python, but nothing about running PS code.</p>
  
  <p>Example: Let's say I want to run this command from inside a Python script\program...</p>
  
  <pre><code>Start-Process -filepath "Path\Filename.exe" -wait
  </code></pre>
  
  <p>I understand in that example I could just run the file using Python. I'm looking into writing a Python app, but it would use some powershell code behind the scenes to actually do what it needs to do. In the case for my app idea, it would connect to Office 365 and manipulate users\account info (add, remove, etc) and things you can't do on the 365 admin site. I already have a PS script to do most of this, but I'm looking into a GUI interface and python seems to be the better choice for GUI (so far as what I've seen and played with).</p>
  
  <p>If this isn't possible, or if it's more pain than it's worth I'd appreciate some suggestions. Should I look into C# or something like that? Python seemed easier to understand.</p>
  
  <p>Thanks.</p>