Read-NetEvents.psm1

<#
.SYNOPSIS
This cmdlet reads a netevents.xml file and parses the content looking for firewall drops. These drops are then emitted to the console in a friendly format.
 
.DESCRIPTION
 
.PARAMETER Path
The hostname used to gather ASN information.
 
.INPUTS
 
 
 
.OUTPUTS
 
 
.EXAMPLE
.NOTES
Requires Windows 8 or later.
 
.LINK
 
#>



function Read-NetEvents{

    param
                                                            (
        
    [Parameter(ParameterSetName="Path",Mandatory=$True,
    ValueFromPipelineByPropertyName=$True , Position=0)]
    [string]$Path = $null
    
    )
    
    [xml]$XMLContent = Get-Content $Path    
    
    
    foreach($NetEvent in $XMLContent.netevents.item){ 
      $Result = New-Object System.Object
        $LocalPort = $NetEvent.header.localport
        $Result | Add-Member -Type NoteProperty -Name LocalPort -Value  $LocalPort
        
        $RemotePort = $NetEvent.header.RemotePort
        $Result | Add-Member -Type NoteProperty -Name RemotePort -Value  $RemotePort
        
        
        $localAddrV4 = $NetEvent.header.localAddrV4
        $Result | Add-Member -Type NoteProperty -Name LocalAddress -Value  $localAddrV4
        
        $remoteAddrV4 = $NetEvent.header.remoteAddrV4
        $Result | Add-Member -Type NoteProperty -Name RemoteAddress -Value  $remoteAddrV4
        $Result
    }
}


export-modulemember -function Read-NetEvents