Skip to main content

Powershell: Get-Content - tail command on Windows

Love tail command on Linux? Try Get-Content with Powershell 3.0+.

Powershell Get-Content

Example: Keep reading the last 20 lines from C:\Windows\WindowsUpdate.log file

PS C:\> Get-Content C:\Windows\WindowsUpdate.log -Tail 20 -Wait
Read 20 last line from C:\Windows\WindowsUpdate.log file
Read 20 last line from C:\Windows\WindowsUpdate.log file

Count how many lines in a text file

PS C:\> (Get-Content C:\Windows\WindowsUpdate.log).Count

Popular posts from this blog

Microsoft Windows Server 2012 R2 Standard Evaluation Product Key

Microsoft Windows Server 2012 R2 Standard Evaluation D2N9P-3P6X9-2R39C-7RTCD-MDVJX DBGBW-NPF86-BJVTX-K3WKJ-MTB6V

ManageEngine ServiceDesk Plus - Reset password

Let's reset the default administrator's password to 'admin'

hmailserver: Notes from the field

hmailserver is one of free open source mail servers running on Microsoft Windows operating system.