Set welcome page
#input parameters
$siteUrl="https://blogs/"
#$pageRelativePath = "Pages/ChamPages/RootBlogsWelcomePage.aspx"
$pageRelativePath = "Pages/default.aspx"
function SetWelcomePage
{
param([string]$siteUrl, [string]$pageRelativePath)
try
{
$site = Get-SPSite $siteUrl
$web = $site.RootWeb
$folder = $web.RootFolder
$folder.WelcomePage=$pageRelativePath
$folder.update()
write-host "Page '" $pageRelativePath "' was set as welcome page for " $siteUrl
}
catch [Exception]
{
write-error $_
}
finally
{
$web.Dispose()
$site.Dispose()
}
}
SetWelcomePage -siteUrl $siteUrl -pageRelativePath $pageRelativePath