Public/Get-LprEventLine.ps1

function Get-LprEventLine {
    <#
    .SYNOPSIS
        Gets a list of LPR events matching the provided criteria.
    .DESCRIPTION
        Gets a list of LPR events matching the provided criteria. The returned items will be of type [VideoOS.Platform.Proxy.Alarm.EventLine],
        which generically represents events of numerous types, so the meaning of property names and values are not always obvious.
 
        - MessageId: Not used
        - ExtensionData: Not used
        - CameraId: The GUID of the camera from which the LPR server recognized a number plate
        - CustomTag: Contains the LPR country module name used to identify the plate
        - Id: Specifies the ID of the specific event in the VMS
        - LocalId: Specifies a "friendly id" used to reference an event
        - Message: Contains the name of the LPR Match List the plate number was found in, or 'Unlisted license plate' if the plate was not recognized
        - Name: Not used
        - ObjectValue: The detected plate number
        - RuleType: A string containing the LPR Match List name, and the display name of the camera
        - SourceId: Same as CameraId
        - SourceName: Specifies the display name of the camera referenced in CameraId
        - Timestamp: A UTC timestamp representing the event was generated
        - Type: Specifies the type of event. This function only returns event lines of type 'LPR Event'
        - VendorName: Not used
    .EXAMPLE
        PS C:\> Get-LprEventLine -StartTime (Get-Date).Date.AddDays(-7) -EndTime (Get-Date).Date
        Gets all 'LPR Event' event lines occurring in the last 7 days prior to midnight of the current day, local time.
    .EXAMPLE
        PS C:\> Get-LprEventLine -StartTime (Get-Date).Date.AddDays(-7) -EndTime (Get-Date).Date | Select-Object Timestamp, ObjectValue, Message
        Gets all 'LPR Event' event lines occurring in the last 7 days prior to midnight of the current day, local time.
        Then selects the most relevant information which could then be passed on to Export-Csv or Out-GridView for example.
    #>

    [CmdletBinding()]
    [OutputType([VideoOS.Platform.Proxy.Alarm.EventLine])]
    param (
        # Specifies that the results returned should be filtered on the specified registration number. A result will be returned if it contains the provided string, which means a partial match is possible.
        # If omitted, all results within the specified time range will be returned.
        [Parameter()]
        [ValidateNotNullOrEmpty()]
        [string]
        $RegistrationNumber,
        # Specifies that the results returned should be filtered on the named LPR Match List. A result will be returned if it contains the provided string, which means a partial match is possible.
        # If omitted, results matching all lists will be returned.
        [Parameter()]
        [ValidateNotNullOrEmpty()]
        [string]
        $MatchList,
        # Specifies that results should only be returned if the timestamp occurs after this time. Default is "one hour ago".
        [Parameter()]
        [DateTime]
        $StartTime = (Get-Date).AddHours(-1),
        # Specifies that results should only be returned if the timestamp is older than this time. Default is "now".
        [Parameter()]
        [DateTime]
        $EndTime = (Get-Date)
    )

    process {
        $conditions = New-Object System.Collections.Generic.List[VideoOS.Platform.Proxy.Alarm.Condition]
        $conditions.Add((New-AlarmCondition -Target Type -Operator Equals -Value 'LPR Event'))
        $conditions.Add((New-AlarmCondition -Target Timestamp -Operator GreaterThan -Value $StartTime.ToUniversalTime()))
        $conditions.Add((New-AlarmCondition -Target Timestamp -Operator LessThan -Value $EndTime.ToUniversalTime()))
        if ($PSBoundParameters.ContainsKey('RegistrationNumber')) {
            $conditions.Add((New-AlarmCondition -Target ObjectValue -Operator Contains -Value $RegistrationNumber))
        }
        if ($PSBoundParameters.ContainsKey('MatchList')) {
            $conditions.Add((New-AlarmCondition -Target Message -Operator Contains -Value $MatchList))
        }
        Get-EventLine -Conditions $conditions -PageSize 1000
    }
}