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

Query all top ten events for a event id on a Event Log

$
0
0

Hello,

First let me say my Posh is very rudimentary and I am fairly new.

I am trying to get all events on a list of servers and write them down on a CSV, so far I modify a bit a script I use for SQL commands from the dbatools.io module.

$outfile = 'C:\out.csv'

GET-Content C:\Servers.txt | ForEach-Object {Get-EventLog -LogName System -Newest 10 -ComputerName $_ | Where-Object {$_.EventID -eq 50, 140} |
But I am bit lost, can anyone point me what I am doing wrong.


Blog: www.sqlservertoolbox.blogspot.com.mx


Viewing all articles
Browse latest Browse all 21975

Trending Articles



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