title: How can I automatically syntax check a powershell script file?
body: <p>I want to write a unit-test for some code which generates a powershell script and then check that the script has valid syntax.</p>
  
  <p>What's a good way to do this without actually executing the script?</p>
  
  <p>A .NET code solution is ideal, but a command line solution that I could use by launching an external process would be good enough.</p>