title: C# won't run PowerShell script
body: <p>I want to call PowerShell script from my C# project but it wont work.</p>
  
  <p>When I run the code I don't get any errors(or I don't know where to find them). 
  I also tried to run script from cmd and script works fine. </p>
  
  <p>My execution policy is set to unrestricted so that is not a problem.</p>
  
  <p>I double checked paths, so these are not problem either.</p>
  
  <p>C# code:</p>
  
  <pre><code>string scriptPath = @"C:\Users\jmiha\Desktop\test.ps1";
  var parameters = new List&lt;String&gt;();
  parameters.Add("test");
  PowerShell ps = PowerShell.Create();
  ps.AddScript(scriptPath);
  ps.AddParameters(parameters);
  ps.Invoke();
  </code></pre>
  
  <p>PowerShell script:</p>
  
  <pre><code>param(
      [Parameter(Mandatory = $true)]
      [String]$param
  )
  Add-Content 'c:\users\jmiha\desktop\test.txt' $param
  
  </code></pre>
  
  <p>When I open the test.txt it is empty.</p>