Change the highlighted part with your Web app URL.
- function enumerateWebParts($Url) {
- $webApp = Get - SPWebApplication $Url# Get WebApplication URL
- foreach($web in $webApp | Get - SPSite - Limit All | Get - SPWeb - Limit All)# foreach loop to iterate through all sites and webs of WebApplication {
- if ([Microsoft.SharePoint.Publishing.PublishingWeb]::IsPublishingWeb($web))# Check
- if site is a publishing site {
- $pWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)
- $pages = $pWeb.PagesList
- foreach($item in $pages.Items) {
- $fileUrl = $webUrl + “/” + $item.File.Url
- $manager = $item.file.GetLimitedWebPartManager([System.Web.UI.WebControls.Webparts.PersonalizationScope]::Shared);
- $wps = $manager.webparts
- foreach($type in $wps)# loop through each type found $wps {
- if ($type - like "**")#
- if webpart $type - like KWizCom select webpart object {
- $wps | select - object @ {
- Expression = {
- $pWeb.Url
- };
- Label = "Web URL"
- }, @ {
- Expression = {
- $fileUrl
- };
- Label = "Page URL"
- }, DisplayTitle, IsVisible, @ {
- Expression = {
- $type
- };
- Label = "Type"
- }
- }
- }
- }
- } else#
- if web is not a publishing site {
- $pages = $null
- $pages = $web.Lists["Site Pages"]
- if ($pages) {
- foreach($item in $pages.Items) {
- $fileUrl = $webUrl + "/" + $item.File.Url
- $manager = $item.file.GetLimitedWebPartManager([System.Web.UI.WebControls.Webparts.PersonalizationScope]::Shared);
- $wps = $manager.webparts
- foreach($type in $wps) {
- if ($type - like "**") {
- $wps | select - object @ {
- Expression = {
- $Web.Url
- };
- Label = "Web URL"
- }, @ {
- Expression = {
- $fileUrl
- };
- Label = "Page URL"
- }, DisplayTitle, IsVisible, @ {
- Expression = {
- $type
- };
- Label = "Type"
- }
- }
- }
- }
- } else {}
- }
- Write - Host "… completed processing"
- $web
- }
- }
- $row = enumerateWebParts('http://hvsp01:10641’) #call the enumerateWebParts function pass it the URL for the web application
- $row | Out - GridView
Run PS script, using the path along with the file name in the management shell.
Here, the required output is given below.

You can filter the details in a more granular level whenever required.
Join the conversation! Your thoughts help the community grow.