Improves certutil output by writing it into eventlog on debug mode

This commit is contained in:
Christian Stein 2020-03-26 07:34:10 +01:00
parent 30a7d6f257
commit d30970b3a9

View file

@ -37,9 +37,17 @@ function ConvertTo-IcingaX509Certificate()
# it is a temp file or we force its creation
if (-Not (Test-Path $TargetFile) -Or $TempFile -Or $Force) {
Write-Output "$Password
$Password" | certutil -mergepfx "$CertFile" "$TargetFile" | Out-Null;
$Password" | certutil -mergepfx "$CertFile" "$TargetFile" | Set-Variable -Name 'CertUtilOutput';
}
Write-IcingaDebugMessage -Message (
[string]::Format(
'Certutil merge request has been completed. Certutil message:{0}{0}{1}',
(New-IcingaNewLine),
$CertUtilOutput
)
);
# If no target file exists afterwards (a valid PFX certificate)
# then throw an exception
if (-Not (Test-Path $TargetFile)) {