Pages

Wednesday 21 January 2015

Using PowerShell to set a custom SharePoint 404 Error Page

Using PowerShell to set a custom SharePoint Error Page

You can define a custom error page for SharePoint (see Jingmei Li's Blog) for instructions.
Here are the PowerShell caommands I used instead of having to compile a console app (step 5 in Jingmei's blog).
PS C:\> [System.Reflection.Assembly]::Load("Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c")
PS C:\> $webapp = [Microsoft.SharePoint.Administration.SPWebApplication]::Lookup("http://www.wssdemo.com")
PS C:\> $webapp.FileNotFoundPage = "wssdemo404.html"
PS C:\> $webapp.Update()
Now try a page that doesn't exists like http://www.wssdemo.com/pages/deletedpage.aspx

No comments:

Post a Comment