Monitoring Log files. (A SfB Story)

I have recently been working on a client site, investigating a Skype for Business Client problem and needed the power of PowerShell.

If you aren't aware of Skype for Business, the software client is like many others in that it writes a running log of what it is doing to a text file. By clicking on various items within the client various lines are written to the log and the log will cycle if gets too big.

Nothing new here! many applications do this. Where PowerShell comes in is a little known parameter of get-content cmdlet called "-wait".



Get Content is awesome for reading log files then piping it to select string. I use this a lot like this:-

Get-Content c:\logfile.txt | select-string "ERROR: "

 Where we can get funky with the "-wait" is by monitoring that file while it is being written.

gc $env:localappdata\Microsoft\Office\16.0\Lync\Tracing\Lync-UccApi-0.UccApilog -Tail 50 -Wait

By running this command the PowerShell session is told to initially show me the last 50 lines and then monitor that file without closing and reopening.



Now you can use the application to replicate the problem, and instantly see what the error log is producing.

I love this tidbit and use it almost every day!

Comments