Provide the URL in $webAppUrl and Below is the code details:-
param($webAppUrl)
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Sharepoint")
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Sharepoint.Administration")
$site=New-Object Microsoft.SharePoint.SPSite($webAppUrl)
$web =
$site.openweb();
$web.AllowUnsafeUpdates=$true;
$MasterPageURL="/_catalogs/masterpage/XYZ_publishing.master"
$web.CustomMasterUrl=$MasterPageURL
$web.MasterUrl=$MasterPageURL
$web.Update()
$web.AllowUnsafeUpdates=$false;
$outputText
= "XYZ publishing
master page is applying in "+ $web.Name +"
site."
write-output $outputText
$web.Dispose()
$site.Dispose()
No comments:
Post a Comment