Day: November 6, 2014

Checking for the Existence of a String Value

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)

What can you do with the Select-String cmdlet? Well, one thing you can do is determine whether or not a specific string value exists in a text file. For example, suppose the file C:\Scripts\Test.txt is a log file that contains the following information:

  You’d like to be able to quickly scan the contents of the file and see whether the word Failed appears anywhere. If it does, that means one of your operations failed; if it doesn’t, that means all of your operations succeeded. (And yes, seeing as how we’re talking about failed operations we do hope you’re not […]