I have this code which does work and is run from a batch file . . .
Code: Select all
set "Log=%userprofile%\Desktop\WinInit_Log.txt"
Powershell -Command "& "Get-winevent -FilterHashTable @{logname='Application'; id='1001'}^|?{$_.providername -match 'wininit'} ^| fl timecreated, message ^| out-file '%Log%'"
Is there a way to ONLY output the latest run data and exclude ALL the previous run data please?
As an extra question please. Is there a similar code that can be run on Win Vista [the above code doesn't work on Vista]. Just curious really! I know that the data can be viewed using Event Viewer => Windows Logs => Application => Actions => Filter => Event Sources => wininit.
Thanks in advance.