/
How to use PowerShell to tail a log file

How to use PowerShell to tail a log file

The unix "tail" command allows a user to view the end of a log file. The command "tail -f filename" will watch the file and display any new lines as they are written to the log file.

There is a powershell equivalent to this. See this article on TechNet.

Step-by-step guide

1.Open Powershell

2.Change to the log folder

cd C:\ProgramData\iQuate\iQSonar4.0\Logs

The Get-Content cmdlet with the Tail parameter will list the last number of lines from the file


If you want to get the effect of "tail -f", use the "-Wait" parameter on the end as well.

Change Directory to the folder containing the log

Type the Get-Content cmdlet with both "-tail N" and "-wait" together

example:

cd C:\ProgramData\iQuate\iQSonar4.0\Logs
get-content service.log -tail 10 -wait

Will display the last 10 lines of the service log, and will then continue displaying any new lines until

the user presses CTRL-C


Related content

How to Tail a log with Notepad ++
How to Tail a log with Notepad ++
More like this
iQCloud - Scan Engine Logs
iQCloud - Scan Engine Logs
More like this
Power Shell Script to reboot iQSonar Service
Power Shell Script to reboot iQSonar Service
More like this
Enable or Disable target logging
Enable or Disable target logging
More like this
How to setup SQL Server Agent job script automation in SQL Server.
How to setup SQL Server Agent job script automation in SQL Server.
More like this
Use RestAPI to get reports from iQSonar V4
Use RestAPI to get reports from iQSonar V4
More like this