Public/Add-LprMatchList.ps1
function Add-LprMatchList { <# .SYNOPSIS Adds a new LPR Match List .DESCRIPTION Adds a new LPR Match List with the given name to the Milestone XProtect VMS. .EXAMPLE PS C:\> $list = Add-LprMatchList -Name Staff -PassThru Creates an LPR Match List named Staff and returns the newly created list #> [CmdletBinding()] [OutputType([VideoOS.Platform.ConfigurationItems.LprMatchList])] param( # Specifies the name of the LPR Match List [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [ValidateNotNullOrEmpty()] [string] $Name, # Specifies that the new LPR Match List object should be returned to the pipeline [Parameter()] [switch] $PassThru ) 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 { $invokeResult = $ms.LprMatchListFolder.MethodIdAddLprMatchList($Name) if ($invokeResult.State -ne 'Success') { Write-Error -Message $invokeResult.ErrorText -ErrorId $invokeResult.ErrorCode -Category ProtocolError } if ($PassThru) { Get-LprMatchList -Name $Name } } } |