PowerShell: Search multiple files for text string

My client had an issue where a script built years ago, deployed by SCCM, had changed the registry settings of IE on some computers.  However, the registry setting was causing new problems and the script needed to be removed from deployment.  The client didn't know which script was causing the issue, so I used this PowerShell script to scan the SMSPKGD$ folder in search of the registry key in the files.

$Extensions = @("bat","cmd","vbs","ps1")

$FoundText = @()

ForEach ($Ext in $Extensions) {

$Text = Select-String \\ServerName\SMSPKGD$\*\*.$Ext -Pattern "Text you are looking for"

$FoundText += $Text }

If ($FoundText) {$FoundText | Out-GridView}

Within a minute I had found the script that was changing the registry and disabled the advertisement.