title: Powershell - help. Search and name file
body: <p>I appreciate any feedback or assistance</p>
  
  <p>The problem i am having is i have a folder that contains log files from all of the machines i'm currently working with. I have several scripts that search the logs looking for predetermined strings, I have another script that will generate a report based on the count of each outcome. However, additionally i would like it tell the machine name of each string outcome. Also, not display anything if nothing was found. Fortunately, i've titled each log file by the machine name in hopes that if it finds the string inside the log it would just have to name the title of the log file it was found in. </p>
  
  <p>Could anyone provide any assistance with this script? I've attempted various scripts using the GCI and if statements to no avail. </p>
  
  <p>Thanks!</p>
  
  <pre><code>$items = get-childitem "path-to-file" 
  
  
  ForEach ($item in $items) 
  {
  
  if ($items -contains "SUCCESS") {
  write-host $items.name
  }
  
  }
  </code></pre>