December 6, 2016

// // Leave a Comment

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()
}


0 comments:

Post a Comment