List the webparts from each page   

Tags: SharePoint 2010, PowerShell, General
Technorati Tags: , ,

I got an e-mail of one my colleagues if anyone had a PowerShell script to list the webparts installed on a page.

So I wrote a simple script that will list the webparts installed on a page.


PowerShell script:


Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue
$s = Get-SPSite "Your url"
foreach($w in $s.AllWebs){
    $l = $w.Lists["Pages"];
    foreach($i in $l.items){
        $f = $i.file
        $url =  [string]::Concat($w.Url ,"/" ,$f.url)
    Write-Host -ForegroundColor Blue $url
    $wpm =     $w.GetLimitedWebPartManager($f.url,[System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
    foreach($wp in $wpm.WebParts)
        Write-Host -ForegroundColor green $wp.Title;
    Write-Host ""
Posted by  Gilissen Timmy  on  9/26/2011
0  Comments  |  Trackback Url  | 0  Links to this post | Bookmark this post with:        

Links to this post


Name *:

CAPTCHA Image Validation