Trying to use Powershell to script the removal of specific custom errors from an IIS website.
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?
Ah... cracked it. It's not Remove-WebConfigurationProperty, it's Clear-WebConfiguration that's used in this context:
Clear-WebConfiguration -Filter "/system.webServer/httpErrors/error[@statusCode='403' and @subStatusCode='4']" -Location IIS:\Sites\www.mysite.com
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.