Monitoring Log Files
To monitor text-based log files, you can use a statement like this:
#requires -Version 3
$path = 'c:\somefile.txt'
Get-Content -Tail 0 -Wait -Path $path | Out-GridView
Just replace the path to the file you want to monitor. Get-Content uses -Tail 0 to read through the end of the existing file. The -Wait parameter then waits for any content change, and displays it in a grid view window. This way, you only see text that is added to the file.
Note that this approach may not work for all files, depending on caching settings.
ReTweet this Tip!