Set default home page using powershell script

Set default master page using the below script

#Author: Prem Kumar
#Date: Feb 11 2015
param(

[string]$InputedURL = $(Read-Host -prompt "Enter Web Application Root URL")
)


try
{
   
    $sourceWeb = Get-SPWeb  $InputedURL
    $oFolder = $sourceWeb.RootFolder;
    $oFolder.WelcomePage = "Pages/Home.aspx";
    $oFolder.Update();
    write-host "Home Page set..,";

}
catch 
{
    write-host "Error in Setting Home Page - $_.Exception.Message"

}
finally
{
    $sourceWeb.Dispose()
}


Comments

  1. I found your blog on Google and read a few of your other posts. I just added you to my Google News Reader. You can also visit Automation Consulting Services for more Webuters Technologies Pvt. Ltd. related information and knowledge, Keep up the great work Look forward to reading more from you in the future.

    ReplyDelete

Post a Comment

Popular posts from this blog

How to copy SharePoint list workflow

INFOPATH FORM HIDE/DISABLE FIELDS BASED ON SHAREPOINT GROUP MEMBERSHIP

KnowledgeLake To Exhibit At SPTechCon In San Francisco on December 5-8 2016