ASP.Net application executing powershell scripts as IIS_USR ASP.Net application executing powershell scripts as IIS_USR powershell powershell

ASP.Net application executing powershell scripts as IIS_USR


I have an ASP.NET site that needs rights to a share to run EXEs and .BAT Files.

This example is using application pool and a local account, you can use a domain account as well.

  1. Create a local account on the server (make it an admin on the server)
  2. Give that account full rights to the folder where the powershell script it.
  3. Create a new IIS Pool and set the account to run under this new local account
  4. Change your site in IIS to use this new pool


Although you might be able to do this, the security implications are not very nice.

For a similar requirement we have created a service layer that handles incoming requests to run a script or command and stores them for a client to pull them of the queue and execute them.

The client could be either a windows service or just a script running on the machine.

There is a very good reason that a web application does not have access to local resources on the computer or network where it is running.

If you want to do it anyway, just configure the application pool to use a different identity as suggested above.