Private/Storage/FlatFile/Get-PukFlatFileRecord.ps1
|
function Get-PukFlatFileRecord { [CmdletBinding()] [OutputType([psobject])] param( [Parameter(Mandatory)] [string]$Path, [Parameter(Mandatory)] [System.Security.Cryptography.X509Certificates.X509Certificate2]$Certificate, [Parameter(ParameterSetName = 'ByDistinguishedName', Mandatory)] [string]$DistinguishedName, [Parameter(ParameterSetName = 'BySerialNumber', Mandatory)] [string]$SerialNumber ) $store = Get-PukFlatFileStore -Path $Path -Certificate $Certificate if ($PSCmdlet.ParameterSetName -eq 'ByDistinguishedName') { return @($store.records) | Where-Object { $_.DistinguishedName -eq $DistinguishedName } | Select-Object -First 1 } return @($store.records) | Where-Object { $_.SerialNumber -eq $SerialNumber } | Select-Object -First 1 } |