I have a PHP script that runs a Powershell Stop-Process
command through shell_exec()
. PHP runs as IUSR. When I run the script, I receive an access denied error message. If I run the command in PowerShell using my Administrator account, it works as expected.
How do I grant IUSR the ability to execute Stop-Process
in Powershell?
I wasn't able to find a solution to grant IUSR the specific privileges to execute Stop-Process
, but I was able to get around this by changing the "Anonymous Authentication" user associated with the kill script from IUSR
to Administrator
.
In IIS 8.5, go to Sites->My Site->Folder Name. On the main panel, click on Authentication under IIS. Right click on Anonymous Authentication and then click on Edit.
You can set the "Anonymous Authentication" value at any level of your IIS app; from the site level to the sub-directory level. I recommend only changing the value from IUSR
to Administrator
on the directory that actually hosts your kill script. Changing it for the whole site might create problems for other parts of the application.