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 is really combersume. In the first line we state "Get-ExchangeCertificate -Thumbprint ...5BE9". This is the thumbprint of the CERT to be renewed.
But we have to confirm "Current certificate: '...EEE7. Replace it with certificate: '...633A" which is not as intended. What to do? The script does not do what is specified. Thanks for any help, Marcel
- Marcel_SchneiderCopper ContributorAnybody tell us how to renew Exchange certificates by scripting as single possibility when MS scripting is not even working? Seems that nobody has a clue. Regards, Marcel
- Fafa24Copper 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_SchneiderCopper ContributorEdy, 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