Find text using PowerShell

I totally broke the setup of a non ConfigMgr system that I’ve been tasked with setting up.

Oops, I did something wrong!

Oops, I did something wrong!

Some how, in some way, I hard coded the TEST SQL server/database rather than the PROD SQL server/database into a config file.  The bigger problem was that this is a system I had never heard of  until a few days ago, so my only hope was combing through logs to find my error.

Log files always have the answer ;)

Log files always have the answer 😉

Once I found it, I started clicking through the install directory only to see there were too many config files and folders to know where to start.  I had two options, open every file or find it in PowerShell.

Here’s what I came up with to find what I was looking for:
dir "C:\program files\Ami FP Test" -I *.* -R | select-string SQLTEST
Sure enough, here’s the very config file where I made the mistake.

PowerShell is KING!

PowerShell is KING!

Found my mistake!

Found my mistake!

Hey, Scripting Guy has a more “pretty” and correct way of using this same method and you should read it.  But if you’re new to PowerShell, I want you to know that if it works, it doesn’t have to be pretty.  Use what works as your base to learn better ways to do things.

Comments are closed.