Forum Discussion
Marcel_Schneider
Apr 24, 2023Copper Contributor
Exchange 2019 CERT renewal with scripting
Hi, we understood that CERT renewals using Exchange Admin Center are no longer possible after CU12 for Exchange 2019, we're currently using 15.02.1118.026. Thus, we're bound to use scripting, which i...
Fafa24
May 01, 2023Copper Contributor
Hi Marcle
I believe my article "Renew Exchange certificate" will help you. It is not that difficult with Powershell.
https://edywerder.ch/renew-exchange-certificate/
Greetings from Switzerland
Edy
Marcel_Schneider
May 02, 2023Copper Contributor
Edy, thank you. The best we can get so far is;
$txtrequest=Get-ExchangeCertificate -Thumbprint D3CF688E33DFA18A290355EE05D963F822785BE9 |`
New-ExchangeCertificate -server "SNMTA20" -DomainName SNNET.CH,autodiscover.snnet.ch,mail.snnet.ch,snmta20.snnet.ch,snmta21.snnet.ch,snmta19.snnet.ch,snadc79.snnet.ch,snadc20.snnet.ch,snadc22.snnet.ch,download.snnet.ch `
-FriendlyName "SNMTA20.SNNET.CH" `
-PrivateKeyExportable $true `
-keysize 2048 `
-SubjectName `
“O=SNNET, OU=SNHQ, L=Dietikon, S=ZH, C=Switzerland, CN=MAIL.SNNET.CH” `
But with a last line as
-GenerateRequest [System.IO.File]::WriteAllBytes (‘C:\CERT-RenewalRequest 2023.req’,[System.Text.Encoding]::Unicode.GetBytes($txtrequest))
We get all kinds of errors, from
Cannot convert argument "chars", with value: "[Subject]
CN=MAIL.SNNET.CH, C=Switzerland, S=ZH, L=Dietikon, OU=SNHQ, O=SNNET
to
At line:1 char:1
+ $txtrequest=Get-ExchangeCertificate -Thumbprint D3CF688E33DFA18A29035 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument
The last error is accuring in many trials. Any suggestions? Best regards, Marcel
$txtrequest=Get-ExchangeCertificate -Thumbprint D3CF688E33DFA18A290355EE05D963F822785BE9 |`
New-ExchangeCertificate -server "SNMTA20" -DomainName SNNET.CH,autodiscover.snnet.ch,mail.snnet.ch,snmta20.snnet.ch,snmta21.snnet.ch,snmta19.snnet.ch,snadc79.snnet.ch,snadc20.snnet.ch,snadc22.snnet.ch,download.snnet.ch `
-FriendlyName "SNMTA20.SNNET.CH" `
-PrivateKeyExportable $true `
-keysize 2048 `
-SubjectName `
“O=SNNET, OU=SNHQ, L=Dietikon, S=ZH, C=Switzerland, CN=MAIL.SNNET.CH” `
But with a last line as
-GenerateRequest [System.IO.File]::WriteAllBytes (‘C:\CERT-RenewalRequest 2023.req’,[System.Text.Encoding]::Unicode.GetBytes($txtrequest))
We get all kinds of errors, from
Cannot convert argument "chars", with value: "[Subject]
CN=MAIL.SNNET.CH, C=Switzerland, S=ZH, L=Dietikon, OU=SNHQ, O=SNNET
to
At line:1 char:1
+ $txtrequest=Get-ExchangeCertificate -Thumbprint D3CF688E33DFA18A29035 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument
The last error is accuring in many trials. Any suggestions? Best regards, Marcel