0

Need some help to list out all custom web parts deployed in all sites pages in an site collection using power shell. Any help appreciated. am able to list out all web parts in all site pages Custom Web parts ...

1 Answer 1

0

Listing web parts used on all site pages using Powershell

[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Publishing") function ListWebParts($web) { if ([Microsoft.SharePoint.Publishing.PublishingWeb]::IsPublishingWeb($web)) { $webPublish = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web) $pages = $webPublish.GetPublishingPages() foreach($page in $pages) { $manager = $web.GetLimitedWebPartManager($page.Url, [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared) $webCollection = $manager.WebParts if($webCollection.Count -ne 0) { for($i =0;$i -lt $webCollection.Count; $i++) { $sw.writeline($web.url + "/" + $page.url + ";" + $webCollection[$i].GetType().Name + ";" + $webCollection[$i].Title) } } } } } function LoadSPSite() { $siteURL = "http://YOUR SITE'S URL" $site = New-Object Microsoft.SharePoint.SPSite($siteURL) foreach($web in $site.allwebs) { write-output $web.Title ListWebParts($web) } $site.Dispose() } $sw = [System.IO.StreamWriter] "PATH TO LOG FILE" $sw.writeline("Page URL;Web Part Type;Web Part Title") LoadSPSite $sw.close() 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.