38 lines
938 B
PowerShell
38 lines
938 B
PowerShell
|
function Export-Cert {
|
||
|
<#
|
||
|
.SYNOPSIS
|
||
|
Exports a Certificate.
|
||
|
#>
|
||
|
|
||
|
[CmdletBinding()]
|
||
|
[OutputType([System.Object])]
|
||
|
Param(
|
||
|
|
||
|
[parameter(Mandatory=$true)]
|
||
|
[string]$exportPath,
|
||
|
|
||
|
[parameter(Mandatory=$false)]
|
||
|
[string]$exportPassword,
|
||
|
|
||
|
[parameter(Mandatory=$true)]
|
||
|
[System.Security.Cryptography.X509Certificates.StoreName]$storeName
|
||
|
)
|
||
|
|
||
|
if ($exportPassword)
|
||
|
{
|
||
|
return ,[Alkami.Ops.Common.Cryptography.CertificateHelper]::ExportAllCertificates(
|
||
|
$storeName,
|
||
|
[System.Security.Cryptography.X509Certificates.StoreLocation]::LocalMachine,
|
||
|
$exportPath,
|
||
|
$exportPassword
|
||
|
);
|
||
|
}
|
||
|
|
||
|
return ,[Alkami.Ops.Common.Cryptography.CertificateHelper]::ExportAllCertificates(
|
||
|
$storeName,
|
||
|
[System.Security.Cryptography.X509Certificates.StoreLocation]::LocalMachine,
|
||
|
$exportPath
|
||
|
);
|
||
|
}
|
||
|
|