Public/Export-LprMatchListEntries.ps1
function Export-LprMatchListEntries { <# .SYNOPSIS Exports the named LPR Match List(s) in a portable CSV format which can be imported again using Import-LprMatchListEntries .DESCRIPTION Exports all entries from one LPR Match List .EXAMPLE PS C:\> Export-LprMatchListEntries -Path .\lprlist.csv Exports all LPR Match List entries from the named LPR Match List to the file lprlist.csv in the current directory. #> [CmdletBinding()] param ( # Specifies the name of the LPR Match List [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [ValidateNotNullOrEmpty()] [string] $Name, # Specifies the full path to the csv file where the LPR Match List entries should be exported [Parameter(Mandatory)] [string] $Path ) 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 } $list | Get-LprMatchListEntry | Export-Csv -Path $Path -NoTypeInformation } } |