Monday, October 24, 2011

Changing welcome page without Publishing Feature enabled

I needed to change the welcome page on a site that did not have the Publishing feature enabled. Since that feature was not enabled, there was no Welcome Page option under Look and Feel. Rather than enabling and disabling the feature, I decided to do this through Powershell.

There are many references on how to do this including this forum post on "Change welcome page of a site collection using PowerShell"


$web = Get-SPWeb <my url>
$rootFolder = $web.RootFolder
$rootFolder.WelcomePage = "<my welcome page>"
$rootFolder.Update()

I tried to shorten it by doing the following
$web.RootFolder.WelcomePage = "<my welcome page>"
$web.RootFolder.Update()

Of course this didn't work because Update() will only work on an instance of RootFolder. It took me a while, but eventually I got it.

No comments:

Post a Comment