簡體   English   中英

我必須使用Powershell中的Remove-WebConfigurationProperty指定什么“名稱”參數來刪除IIS定制錯誤?

[英]What “Name” parameter must I specify to remove an IIS custom error using Remove-WebConfigurationProperty in Powershell?

嘗試使用Powershell編寫腳本來清除IIS網站中的特定自定義錯誤。

我已經做到了這一點:

Remove-WebConfigurationProperty -Filter "/system.webServer/httpErrors/error[@statusCode='403' and @subStatusCode='4']" -Location IIS:\Sites\www.mysite.com

但運行失敗並顯示以下警告:

Remove-WebConfigurationProperty : Cannot bind argument to parameter 'Name' because it is an empty string.

我不知道在這里為Name參數指定什么,並且Remove-WebConfigurationProperty的文檔嚴重不足...任何想法嗎?

啊...破解了。 它不是Remove-WebConfigurationProperty,在此上下文中使用的是Clear-WebConfiguration:

Clear-WebConfiguration -Filter "/system.webServer/httpErrors/error[@statusCode='403' and @subStatusCode='4']" -Location IIS:\Sites\www.mysite.com

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM