none
option to simulate tail, using powershell - get-content and wait RRS feed

  • Question

  • i´m trying to see the windowsupdate.log n real time, like bash tail binary

    i´m trying to sue get-contet file.txt -wait

    but it only read new lines when I open in NotePad

    What i´m doing wrong?

    i´m using Win2012R2

    Monday, August 12, 2019 7:26 PM

All replies

  • Get-Content windowsupdate.log -Tail 1 -Wait


    \_(ツ)_/

    Monday, August 12, 2019 8:32 PM
  • No, same thing, with or w/o -tail and/or -wait parameter

    i can only see file being updated, when i open in notepad or when a do a "type filename", kind of "an access" of the file

    Maybe the problem is related to the open mode (exclusive or non-exclusive) by the windows udpate application

    installing more than 100 patches, the file was not updated a single time, all updates were related to some kind of "external access" to the file, like "type', opening with some application, etc

    Tuesday, August 13, 2019 4:42 PM
  • While an update is in progress the file is locked and cannot be "tailed".  This is a limitation of Get-Content.  You can  use third party tools which can open the file "shared/readonly".


    \_(ツ)_/

    Tuesday, August 13, 2019 4:45 PM
  • As a workaround you can still read the log files 

    $a = gc $path\log.txt

    start-sleep -second 2

    $b = gc $path\log.txt

    you will read the value of readcount and show the content that is added recently (after last run) in log file and show that portion in console or anywhere.

    Tuesday, August 13, 2019 5:14 PM