creating a custom http error for single site in powershell [Answered]RSS

1 reply

Last post Dec 27, 2011 03:26 PM by sdeeney

  • creating a custom http error for single site in powershell

    Dec 27, 2011 11:14 AM|sdeeney|LINK

    I am trying to create a custom http error for an individual site. I am creating a script to set up sites and app pools in IIS7 when we deploy new sites to the server. When I poke around in powershell looking at the sites that were set up using the IIS gui I cannot find the errors that were added for the site, just the inherited ones. I tried something and it killed all of the other sites by replacing the default errors with the single custom one I was trying to create. I think this is what I tried. I did it last week before Christmas and I don't remember if I fiddled with it at all after. any help would be appreciated. Set-WebConfiguration -name collection -filter system.webServer/httperrors -location "iis:\sites\$siteName" -value @{statuscode=403; substatuscode=4; path="https:\www.site.com"; responsemode='Redirect'}

    PowerShell powerShell IIS7 iis snap-in iis7 powershell snap-in custom http error

  • Re: creating a custom http error for single site in powershell

    Dec 27, 2011 03:26 PM|sdeeney|LINK

    I figured it out after fixing another issue I had. this is how you ADD a new http error. Add-WebConfiguration -filter system.webserver/httperrors -location $siteName -value @{statuscode=403; substatuscode=4; path="https:\www.site.org"; responsemode='Redirect'}