0

I want to modify the IIS Web application Handler mappings permissions.

I did this manually like below.

Open IIS , Site/Web application, Clicked Handler Mappings, in Actions Clicked “Edit Feature Permissions “, then uncheck/Check the Script.

I want to automate this using PowerShell.

I can read the permission status using the below code.

Get-WebConfigurationProperty -Filter /system.webServer/handlers -name accesspolicy -PSPath IIS:\ -Location 'Default Web Site/WebApplication’

I tried same way to modify the permission using below code. But this is not working. Could anyone please let me know What I did wrong here.

Set-WebConfigurationProperty -Filter /system.webServer/handlers -name accesspolicy -value "Script" -PSPath IIS:\ -Location 'Default Web Site/WebApplication’ –Force
4

1 回答 1

1

我认为您非常接近,但您的目标是 ISAPI-dll,而不是单个处理程序。这是各个处理程序的代码(我仍然使用 ISAPI-dll 作为示例):

Set-WebConfiguration "/system.webServer/handlers/add[@name='ISAPI-dll']/@requireAccess" -Value "Execute" -PSPath "IIS:/sites/Default Web Site"

这是启用所有处理程序(包括 ISAPI-dll)访问的代码:

Set -WebConfiguration "/system.webServer/handlers/@AccessPolicy" -value "Read, Script, Execute"

将部件留-PSPath在服务器级别。

删除“执行”以禁用 ISAPI-dll。

此外,链接可以作为有用的参考。

于 2014-03-06T16:09:46.587 回答