[英]What “Name” parameter must I specify to remove an IIS custom error using Remove-WebConfigurationProperty in Powershell?
Trying to use Powershell to script the removal of specific custom errors from an IIS website. 尝试使用Powershell编写脚本来清除IIS网站中的特定自定义错误。
I have got this far: 我已经做到了这一点:
Remove-WebConfigurationProperty -Filter "/system.webServer/httpErrors/error[@statusCode='403' and @subStatusCode='4']" -Location IIS:\Sites\www.mysite.com
but running that fails with a warning that: 但运行失败并显示以下警告:
Remove-WebConfigurationProperty : Cannot bind argument to parameter 'Name' because it is an empty string.
I have no idea what to specify for the Name
parameter here - and Remove-WebConfigurationProperty is woefully underdocumented... any ideas? 我不知道在这里为
Name
参数指定什么,并且Remove-WebConfigurationProperty的文档严重不足...任何想法吗?
Ah... cracked it. 啊...破解了。 It's not Remove-WebConfigurationProperty, it's Clear-WebConfiguration that's used in this context:
它不是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.