Parse Events via PowerShell into table

Parsing Events via PowerShell into table
Optometrist eye testing equipment picture


Parse Events via PowerShell into table.  Ever have need to parse an event, and grab a field from the event description, then perform some action after that?


Here’s some PowerShell that may help you first to create a table, then setup columns, gather data, then parse what you need, and run a command to then output to the table


# Create Table for alerts

$Table = @()

$Table = $null


$Table = New-Object System.Data.DataTable “Failed Hosts List”

$Col1 = New-Object System.Data.DataColumn Host

$Col2 = New-Object System.Data.DataColumn IPAddress





$Alert20046 = Get-WinEvent -FilterHashtable @{LogName=’Operations Manager’;



$Alerts20046 = $Alert20046.Message



$Alerts20046uniq = $Alerts20046 | sort -uniq



# $DeniedUniq = $Denied20046 | Sort-Object -Uniq

# $ServersDenied = @()


foreach ( $server in $DeniedUniq)


$Name = nslookup $server

foreach ($server in $Name)


# Add to Table   

# $Name.Split(“:”)[6]

# $Name.Split(“:”)[8]

$row = $Table.NewRow()

$row.Host = $Name.Split(“:”)[6]

$row.IPAddress = $Name.Split(“:”)[8]





Leave a Reply

Your email address will not be published. Required fields are marked *