我必须指定什么“名称”参数才能使用Powershell中的Remove-WebConfigurationProperty删除IIS自定义错误?

时间:2012-06-19 19:46:43

标签: iis 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参数指定了什么 - 而且删除了WebConfigurationProperty可疑的文档...任何想法?

1 个答案:

答案 0 :(得分:3)

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

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