This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

powershell get-content

I'm trying to create a powershell monitor, to read a log file and look for a word.

Script is as so:

$Lines = Get-Content -path "C:\Windows\tracing\logfile.log"

foreach ($Line in $Lines){

if ($Line -like "*Successful*"){$Health = "good"}

}

I get this error when testing the script:

Get-Content : Cannot find path 'C:\Windows\tracing\logfile.log' because it does not exist.

But it does exist, and I am using sufficient credentials.