Created
May 8, 2016 11:27
-
-
Save hemache/66e3c91de613d46ba44be4b412050d32 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# variables | |
$siteUrl = "http://www.example.ma" | |
$defaultPageFileName = "Home.aspx" | |
Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue | |
$web = GetSPWeb -Identity $siteUrl | |
if([Microsoft.SharePoint.Publishing.PublishingWeb]::IsPublishingWeb($web)) { | |
$publishingWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web) | |
$publishingWeb.DefaultPage = ($publishingWeb.PagesList.Items | Where-Object { $_.File.Name -eq $defaultPageFileName }).File | |
$publishingWeb.Update() | |
} else { | |
Write-Error "this site doesn't use publishing site template" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment