Scenario: I have 300 scripts in a directory, but I am not sure which script is running a specific command. Using the following, you can quickly parse through all of your scripts and locate the string ( Command | Word | Phrase ) to see which script has it.
Solution: Scritplet:
$str = "BACKPRESSURE"
get-childitem C:\scripts\*.ps1 -Recurse | Select -ExpandProperty Fullname | %{
$fn = $_
$str | %{
$s = $_
$D = get-content $fn | Select-String $s
If($D -ne $Null){
Write-Host "
Found String in File: $fn" -ForegroundColor Cyan
$D
} #ENdIF
}##end $Str loop
}#End get-childitem loop