Skip to content

Instantly share code, notes, and snippets.

@joe-scalise
Last active November 9, 2018 17:06
Show Gist options
  • Select an option

  • Save joe-scalise/76f52b3ec0f62a780df85416e6b0dac2 to your computer and use it in GitHub Desktop.

Select an option

Save joe-scalise/76f52b3ec0f62a780df85416e6b0dac2 to your computer and use it in GitHub Desktop.
Example on How to Tail the Windows Event Log
$latest = (get-eventlog -LogName 'Application' -Source 'docker' -Newest 1).Index
while ($true)
{
Start-Sleep -m 5000
$tail = (get-eventlog -LogName 'Application' -Source 'docker' -Newest 1).Index
[int]$grab = $tail - $latest
if ($grab -gt 0) {
get-eventlog -LogName 'Application' -Source 'docker' -newest $grab | sort index | select Index, TimeGenerated, Message
$latest = $tail
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment