Search a string in folder/subfolders on multiple computers

Welcome Forums General PowerShell Q&A Search a string in folder/subfolders on multiple computers

Viewing 1 reply thread
  • Author
    Posts
    • #50922
      Participant
      Topics: 41
      Replies: 41
      Points: 23
      Rank: Member

      Hi,
      I had a query which will find a string in a folder on multiple servers:
      $Servers = Import-CSV "C:\Users\venkatak\Desktop\Test\search\deploy.csv"
      $Drives = "c:\test\"

      Get-ChildItem -Path $Drives -recurse | Select-String -pattern “domain” | group path | select name | Export-CSV findfiles.csv -notypeinformation

      But, I am not getting the desired output.

      I am looking for output such a way that, I have two servers names in deploy.csv (server names: 1 & 2).
      The output should be the file name & path which string is present & output a file as 1_output.log (each server should have separate log).

      -Kalyan

    • #50924
      Participant
      Topics: 18
      Replies: 573
      Points: 32
      Rank: Member

      The path is always going to be c:\test\ and you aren't using $servers. Take everything out after recurse and be sure you're returning stuff before you continue.

Viewing 1 reply thread
  • The topic ‘Search a string in folder/subfolders on multiple computers’ is closed to new replies.