title: How to execute a PowerShell script using c#
body: <p>I need to execute a PowerShell script using c#</p>
  
  <pre><code>ProcessStartInfo startInfo = new ProcessStartInfo();
              startInfo.FileName = @"cmd.exe";
              startInfo.Arguments = @"powershell -File ""C:\Users\user1\Desktop\power.ps1""";
              startInfo.Verb = "runas";
              startInfo.RedirectStandardOutput = true;
              startInfo.RedirectStandardError = true;
              startInfo.UseShellExecute = false;
              startInfo.CreateNoWindow = true;
              Process process = new Process();
              process.StartInfo = startInfo;
              process.Start();
              process.WaitForExit();
  </code></pre>
  
  <p>This does not work. Can someone help me?
  I have a PowerShell script file and sometimes it will have arguments to pass </p>