From 596e6717d9202c84b342a5ad1580ae13592fb781 Mon Sep 17 00:00:00 2001 From: andreasjordan Date: Wed, 3 Apr 2024 21:35:55 +0200 Subject: [PATCH] dates are only valid for self-signed certs (do New-DbaComputerCertificate) --- public/New-DbaComputerCertificate.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/New-DbaComputerCertificate.ps1 b/public/New-DbaComputerCertificate.ps1 index 257375331ce0..b519a9c885e3 100644 --- a/public/New-DbaComputerCertificate.ps1 +++ b/public/New-DbaComputerCertificate.ps1 @@ -349,11 +349,11 @@ function New-DbaComputerCertificate { Add-Content $certCfg "ProviderType = 12" if ($SelfSigned) { Add-Content $certCfg "RequestType = Cert" + Add-Content $certCfg "NotBefore = $((get-date).ToShortDateString())" + Add-Content $certCfg "NotAfter = $((get-date).AddMonths($MonthsValid).ToShortDateString())" } else { Add-Content $certCfg "RequestType = PKCS10" } - Add-Content $certCfg "NotBefore = $((get-date).ToShortDateString())" - Add-Content $certCfg "NotAfter = $((get-date).AddMonths($MonthsValid).ToShortDateString())" Add-Content $certCfg "HashAlgorithm = $HashAlgorithm" Add-Content $certCfg "KeyUsage = 0xa0" Add-Content $certCfg "[EnhancedKeyUsageExtension]"