Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Event log checking excel

$
0
0
$Date = Get-Date
$Range = $Date.addDays(-1)
$Unique = $Unique | Select -Unique

Get-Winevent -FilterHashtable @{LogName="System","Application"; Level=1,2,3; startTime=$range} | Select-Object @{ expression={$_.LevelDisplayName}; label='Level' }, Message, @{ expression={$_.ID}; label='EventID' },  @{ expression={$_.LogName}; label='Log' }, @{ expression={$_.MachineName}; label='Server' }, @{ expression={$_.TimeCreated}; label='Created' } | export-csv "C:\scripts\sysevents.csv" -NoTypeInformation

The code shown here is a mash up of ones from the internet but it gets the job done. I want to expand it slightly.

I wish for the event log to search the previous days excel sheet and ONLY add ones that are not on it. I know you can compare .csv files but not sure how I would do it. If someone could point me in the right direction that be awesome!


If this is helpful please mark it so. Also if this solved your problem mark as answer.



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>