Finding CEWP’s with script in your SharePoint sites

One of the most annoying things I regularly encounter is undocumented environments. Nothing freaks me out more than this.

For instance, last week, I stumbled onto a search results page which didn’t work anymore. Seems that once upon a time, someone added a content editor webpart with some javascript on there. That javascript called a webservice and this failed.

If I didn’t have the reflex of putting that page in edit mode, I would never have guessed this. This lead me to the creation of the following… a PowerShell script which identifies all pages, forms and views for a webapplication which has:

  • a CEWP with the <script> tag
  • a CEWP with a contentlink that points to a textfile wich has the <script> tag

This way, I don’t have to go fish for these things if people are too damn lazy to create some documentation.