Share via


SharePoint 2010: How to Use GREP

Grep searches the named input FILEs (or standard input if no files are named, or the file name - is given) for lines containing a match to the given PATTERN.  By default, grep prints the matching lines.

In addition, two variant programs egrep and fgrep are available. Egrep is the same as grep -E. Fgrep is the same as grep -F.

I was getting this error everyday. That my application server couldn’t reach a database and the login failed for the specific managed account.

The problem actually is that the database event exists anymore. But SharePoint tries every hour to reach this database. So I thinked that the database could be “hard coded” on a file situated  under 14/ ( or 15/ for SharePoint 2013).

Actually if your have only 1 web application, you will have only a few web.config to verifiy ( with central administration, etc… )

But what will you do, if you have 3 or more web applications?

Yes I can hear you, you will use GREP !

Yeah Grep, but is it free? Will your Project Manager or Change Manager accept that you install a program on the server because you are to lazy?

Will they paiy for only one error on the eventviewer? If the answer is YES go a head an download it on http://www.wingrep.com/register.htm

But wait !! Maybe I can help you.. The best friend of SharePoint Administrator is a Powershell scripting guy ! ( Yeah SQLMAN will be very jealous )

You can use this little script who will search every word in every file that you will provide him.  This little script will help you find the word “SRV-DB-SQL_My_Content” in every config file under 14\

 gci "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\" -include *.config -recurse | select-string -pattern "SRV-DB-SQL_My_Content" -caseSensitive