Subscribe:

Labels

Wednesday, August 12, 2020

Get Site Master Pages

 Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

"URL,MasterPage" > "c:\SiteMasterPage.csv" #Write the Headers in to a text file 

#Get All site collections

$SiteCollections = Get-SPWebApplication | Get-SPSite -Limit All

#Loop through all site collections

   foreach($Site in $SiteCollections)

    {

        #Loop through all Sub Sites

       foreach($Web in $Site.AllWebs)

       {

                  write-host "Scanning Site" $web.title "@" $web.URL 

       $web.Url + "," + $Web.CustomMasterUrl  >> c:\SiteMasterPage.csv  #append the data 

                 }

    }

Write-host "Report Generated at c:\SiteMasterPage.csv" -foregroundcolor green 


No comments:

Post a Comment