1

I am having trouble figuring out how to match the text with wildcards. The script works for finding ServerName= but I can't figure out how to find ServerName=GSW-ACE-01 The text after the equal sign is different so I need a wildcard to pull all text after ServerName=. I tried some different regex (ServerName=[A-Z][A-Z][A-Z]\W[A-Z][A-Z][A-Z]\W[A-Z][A-Z][0-9][0-9]) but it returns whatever I type in the script and not what is in the config file I'm searching.

Get-Content c:\temp\ServerList.txt |
    ForEach-Object{
    Select-String -path "\\$_\c$\GrAPE\config.ini" -pattern "ServerName=*" -List
    }| 
    Select path, pattern |
    Export-Csv C:\Temp\Servername.csv -NoType -Append
ayhnhakn
  • 107
  • 3
  • 8
PapaDoc
  • 11
  • 1

0 Answers0