title: .ps1 cannot be loaded because the execution of scripts is disabled on this system
body: <p>I run this code to execute PowerShell code from an ASP.NET application:</p>
  
  <pre><code>System.Management.Automation.Runspaces.Runspace runspace = System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace();
  runspace.Open();
  System.Management.Automation.Runspaces.Pipeline pipeline = runspace.CreatePipeline();
  pipeline.Commands.AddScript(@"\\servername\path");
  
  pipeline.Commands.Add("Out-String");
  
  Collection&lt;PSObject&gt; results = pipeline.Invoke();
  
  runspace.Close();
  </code></pre>
  
  <p>But I am getting an error:</p>
  
  <blockquote>
    <p>.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>The same code runs fine from a command prompt or a windows (Windows Forms) application.</p>