1 Replies - 2013 Views - Last Post: 27 June 2012 - 08:01 AM Rate Topic: -----

#1 webmin88  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 22-October 11

POWERSHELL - Using powershell to add custom error pages to IIS

Posted 28 April 2012 - 11:12 AM

Hello,

I have a Window 2008 server with Plesk installed, and I am working on a project to build a Powershell cmdlet that will allow me to add a 500-100.asp error page to IIS.

Now I know how to build the cmdlet, what I'm not sure of is how to interface with IIS from powershell. I have the IIS Snapin for IIS installed, however I'm not sure how complete this with that. I've also tried importing the WebAdministration Module, which I have an idea how to do it with that, however I'm not sure I have the right Syntax for that.

Here's what I have so far:

import-module WebAdministration
add-WebConfiguration -Filter /System.WebServer/HttpErrors -Value @{StatusCode=500-100;PrefixLanguageFilePath="$Null";  Path="http://smartertest.com"; ResponseMode="Redirect"} -PSPath "IIS:\smartertest.com/error_docs/500-100.asp"



Normally what I have to do to enable this error page, is copy the file from a network shares into C:\inetpub\vhosts\smartertest.com\error_docs, and then open IIS >> Go to the Site >> Open the Error Pages >> Add >> 500.100 >> Slect Execute a URL on this site >> enter /error_docs/500-1000.asp and click ok.

Can anyone think of an efficient, powershell friendly way to do this? Your help is appreciated, and I will be sure to acknowledge your contribution. Thanks.

Is This A Good Question/Topic? 0
  • +

Replies To: POWERSHELL - Using powershell to add custom error pages to IIS

#2 webmin88  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 22-October 11

Re: POWERSHELL - Using powershell to add custom error pages to IIS

Posted 27 June 2012 - 08:01 AM

Does anyone have any ideas for this?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1