Finding Text In All Files In A Folder With PowerShell

Whilst writing my PowerShell Box of Tricks GUI I realised that I had hard-coded the path to the sqlservers.txt file in several functions and I wanted one place where I could set this. At the top of the GUI script I added a variable and in the ReadMe explained this needed to be set but I needed to change it in all of the functions where it was referenced.

The Hey Scripting Guy Blog came to the rescue

image

Only four entries so i di them manually but You can also use PowerShell to replace the entries.

Please feel free to comment on this post. All comments are moderated first before appearing on the site