Search a string in folder/subfolders on multiple computers

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Dan Potter Dan Potter 1 month, 1 week ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #50922
    Profile photo of Venkata Kalyan
    Venkata Kalyan
    Participant

    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
    Profile photo of Dan Potter
    Dan Potter
    Participant

    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 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.