title: Sorting eventlog in powershell
body: <p>I am using a command that will display the eventlog of a remote machine and filter it by the eventId. What I am trying to do is have it only show me the recent X events. Like 1, 5, 10, however many I specify. I says to use <code>-newest 5</code> , but when I try to get newest events after filtering them by eventId for example, it won't let me do it</p>
  
  <pre><code>Get-EventLog system -computername c78572 | select eventid,machinename,timewritten | where {$_.eventid -eq 6009} | ft -autosize
  </code></pre>
  
  <p>Basically I want to display a specific EventID of a remote system, and only show the most recent 5 of them.</p>