How to search for a specific string within multiple XML files (PowerShell)

Scenario: you want to find what SharePoint 2010 feature is associated to a specific GUID (a GUID that looks like: 1CC4B32C-299B-41AA-9770-67715EA05F25)

Solution:

  • open Windows PowerShell and change the folder to: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES>
  • run the following PowerShell script: Get-ChildItem -filter *.xml . -recurse | Select-string -pattern “1CC4B32C-299B-41AA-9770-67715EA05F25” | format-list filename, path

The result will look like:

 

Filename : FEATURE.XML
Path     : C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\AccSrvApplication\FEATURE.XML

So the GUID is related to the feature called AccSrvApplication