I need search then extract content from multiple .txt files and then save each search result as separate txt files i.e. serverabc.systeminfo.txt. I am very new to powershell and ask for your understanding in my knowledge. The below works however it returns all results to a single systeminfo.txt file that does not list what folder/file the results came from. Ideally i need a single file output for each systeminfo extraction. In the Extracted folder there are multiple folders i.e abc123, def456 etc. Each file needs to search systeminfo file within for either "abc software" or "def software" then if found output that result to a single text file i.e. abc123.systeminfo etc. Once these files have been saved they will then be compared against a master.txt file for differences. This is what i have so far: $path = "H:\Compare\Extracted" $Text = "abc Software" $Text2 = "def Software" $Results = "H:\Compare\Results\$($file.name).txt" $files = Get-ChildItem $path -recurse -Include *.txt foreach ($file in $files) { get-content $file | select-string -Pattern $Text, $Text2 | select line | out-file $Results -append } Thanks for your help. |