How to set IIS users/permissions to execute a Process.start() in the web application?



I have a powershell script file called Script1.ps1 And I execute it from a web application in ASP.NET with the following code:

 process.StartInfo.FileName = @"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe";
 process.StartInfo.Arguments = $"-File \"{ScriptNameOne}\" \"{param1}\"  \"{param2}\" \"{param3}\"";
 process.StartInfo.UseShellExecute = true;

The problem is when I deploy my web app in IIS the process doesn’t start.
I don’t get any error, just my powershell doens’t run.

the code works fine in my IIS express from visual Studio, because my user in the computer is executing all the process, so I have permissions to every source in the machine.

Important: I need to execute this powershell script LOCALLY IN THE SERVER WHERE THE SITE IS.

I know that is user/permissions Issue, so…
In IIS, which permissions do I need?
What of all IIS users should I use?
Do I need give permissions in the folder where the powershell.exe is?



  1. Right click the directory where the .EXE file is and select Properties
  2. Select the Security tab
  3. Click the Edit button and then Add button
  4. Click the Locations button and make sure that you select your computer
  5. Enter IIS AppPool<appoolname> (eg: IIS AppPool\DefaultAppPool)

Answered By – Liz Bundy

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More