ADCSTemplate icon indicating copy to clipboard operation
ADCSTemplate copied to clipboard

Appending template supersedence not possible.

Open Geo-Ron opened this issue 1 year ago • 1 comments

the property msPKI-Supersede-Templates is not set in the New-ADCSTemplate command.

I will try to implement this and create a merge request

Geo-Ron avatar Feb 14 '24 13:02 Geo-Ron

Live Action example:

Import-Module ADCSTemplate # Do not use the powershell gallery version of this module. Use the included one
Import-Module PSPKI

$entCA = Connect-CertificationAuthority
$originOCSPTemplate = Get-CertificateTemplate | Where-Object DisplayName -eq 'OCSP Response Signing'
$templateJSON = Export-ADCSTemplate -DisplayName $originOCSPTemplate.DisplayName
$templateObject = $templateJSON | ConvertFrom-JSON
$templateObject.name = 'OCSPResponseSigningv1.0'
$templateObject.DisplayName = 'OCSP Response Signing v1.0'
$templateObject.flags = 131648
$templateObject.'msPKI-Enrollment-Flag' = 20512
$templateObject.'msPKI-Private-Key-Flag' = 101056512
$templateObject.'msPKI-Template-Schema-Version' = 4
$templateObject.'msPKI-Template-Minor-Revision' = $templateObject.'msPKI-Template-Minor-Revision' +1
$templateObject.'msPKI-Minimal-Key-Size' = 4096
$templateObject.'msPKI-RA-Application-Policies' = $templateObject.'msPKI-RA-Application-Policies' -replace 'SHA1','SHA256'
$templateObject | Add-Member -MemberType 'NoteProperty' -Name msPKI-Supersede-Templates -Value @(($templateJson | ConvertFrom-Json).Name)

New-ADCSTemplate -DisplayName $templateObject.DisplayName -JSON ($templateObject | ConvertTo-JSON) -Publish

Geo-Ron avatar Feb 14 '24 13:02 Geo-Ron