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 に答える