當我使用以下Powerhell腳本時,IIS中的我的網站的匿名身份驗證不會從「已啓用」更改爲「已禁用」。任何人可以幫助請: -Powershell - 無法在網站的IIS中禁用匿名身份驗證
Import-Module WebAdministration
Set-WebConfigurationProperty -filter /system.webServer/security/authentication/anonymousAuthentication -name enabled -value false -PSPath IIS:\Sites\myWebsite -Force
我也試過這樣: -
Set-WebConfigurationProperty -filter /system.webServer/security/authentication/anonymousAuthentication -name disable -value true -PSPath IIS:\Sites\myWebsite -Force
我也曾嘗試: -
Set-WebConfigurationProperty -filter '/system.webServer/security/authentication/anonymousAuthentication' -name enabled -value false -PSPath IIS:\Sites\myWebsite -Force
我也試過,但還是老樣子不起作用: -
Set-WebConfigurationProperty -Filter /system.webServer/security/authentication/anonymousAuthentication -name Enabled -value False -PSPath 'IIS:\' -Location "Sites\myWebsite"
我沒有收到任何錯誤RS。看起來腳本成功運行。
另外,有沒有人知道我將如何設置表單身份驗證禁用呢?
所以看起來像我能驗證設置爲「Enabled」如果我這樣做: -
Set-WebConfigurationProperty -Filter /system.webServer/security/authentication/anonymousAuthentication -name Enabled -value true -Location "IIS:\Sites\myWebsite"
但我不能身份驗證設置爲「已禁用」如果我這樣做: -
Set-WebConfigurationProperty -Filter /system.webServer/security/authentication/anonymousAuthentication -name Enabled -value false -Location "IIS:\Sites\myWebsite"
不知道這會工作,但也許嘗試在單引號包裹你的過濾器?它讀取'/'作爲轉義字符的可能性很小。 –
嗨,邁克。感謝您的幫助,但不幸的是,這並沒有工作:-(。 – ED209
你可以嘗試寫False而不是假的 –