Public/Clear-LprMatchList.ps1
function Clear-LprMatchList { <# .SYNOPSIS Clears all registration numbers from a given LPR Match List .DESCRIPTION Clears all registration numbers from a given LPR Match List .EXAMPLE PS C:\> Clear-LprMatchList -Name Staff Clears all registration number entries from the LPR Match List named 'Staff' or returns an error if no such list is found. #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact='High')] [OutputType([VideoOS.Platform.ConfigurationItems.LprMatchList])] param( # Specifies the name of the LPR Match List to get. Wildcards are supported. [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [ValidateNotNullOrEmpty()] [string] $Name ) begin { $ms = Get-ManagementServer if ($null -eq $ms.LprMatchListFolder) { throw "Milestone XProtect LPR Plugin is not installed or was not loaded in the current session. Please ensure the plugin is installed. If LPR cannot be managed from Management Client on this system, it cannot be managed from PowerShell either." } } process { $list = $ms.LprMatchListFolder.LprMatchLists | Where-Object Name -eq $Name if ($null -eq $list) { Write-Error "No LPR Match List found matching name '$Name'" -Category ObjectNotFound return } if ($PSCmdlet.ShouldProcess("LPR Match List '$Name'", "Delete all Registration Numbers")) { $invokeResult = $list.MethodIdDeleteAllRegistrationNumbers() if ($invokeResult.State -ne 'Success') { Write-Error -Message $invokeResult.ErrorText -ErrorId $invokeResult.ErrorCode -Category ProtocolError } } } } |