Find a given webpart in the given site collection


Today I am providing the Power Shell Script that is useful to find out a given web part (or all) in all the pages in all over the given site collection.

.Inputs

Path - Provide log file path to save the web part report.

Sitecollection url - provide site collection url where the given web part will be searched.

Webpart name - Enter the webpart name, Name is case sensitive (Use wild card (*) if you want to match a particular string in name like you can use *bp* to get the list of all page that contains any webpart which contains bp in its name or provide * to get the list of all webparts

 

.Outputs

A CSV file will be generated with the url of the pages where a given web part is available. or all the web parts available.

 

Example-

.\scriptname.ps1

.\scriptname.ps1 | out-file “FilePath\Filename.txt”

 

Dependencies –

For executing this script user must be added in site collection administrators in the sites.

User should have Shell Admin rights to run the scripts.
Run Management Shell as an Administrator.
How to execute -
Copy this script and paste in Note pad.
Save this file as .ps1.
Run this script in SharePoint Management Shell. You can run this script in PowerShell as well.
Follow on screen instructions.

FOR ANY HELP ON THIS SCRIPT USE "GET-HELP .\SCRIPTNAME.PS1 --FULL" AFTER SAVING THIS FILE.


 

No comments:

Post a Comment