I want to search for all files, of .exe.config for certain strings. I want to list the files with those strings and then list all of the files that were checked. I can get it to find the files with the strings with:
Get-ChildItem -Path c:\ -I *.exe.config -R| Select-String 'string1','string2'
My issue, I can't figure out how to get it to show all the .exe.config files that it checked (without searching the computer again). I thought I could save the intial search results into a variable. Then run through that with a for loop, but I can't even get the right info into a variable. I tried several variations of below, but $files is always empty. Also, I'm not sold on this approach, so if anyone has a completely different method, that would be fine
$files = (Get-ChildItem -Path c:\ -I *.exe.config -R).Path
$files = (Get-ChildItem -Path c:\ -I *.exe.config -R | select fullname)