PSPKI icon indicating copy to clipboard operation
PSPKI copied to clipboard

Get-CertificateTemplate

Open krzysztofmaczynski opened this issue 4 years ago • 1 comments

New-Object : Exception calling ".ctor" with "1" argument(s): "Value was either too large or too small for a UInt32." At C:\PSPKIAudit-main\PSPKI\3.7.2\Server\Get-CertificateTemplate.ps1:67 char:48

  • ... ach-Object {New-Object PKI.CertificateTemplates.CertificateTemplate $ ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException
    • FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand

DEBUG: $error[0].Exception.InnerException.StackTrace at System.ParseNumbers.StringToInt(String s, Int32 radix, Int32 flags, Int32* currPos) at System.Convert.ToInt32(String value, Int32 fromBase) at PKI.CertificateTemplates.CryptographyTemplateSettings.get_keyusages() at PKI.CertificateTemplates.CryptographyTemplateSettings.InitializeDs() at PKI.CertificateTemplates.CertificateTemplateSettings..ctor(IDictionary`2 Entry) at PKI.CertificateTemplates.CertificateTemplate.m_fillproperties(String ldapPath)

krzysztofmaczynski avatar Sep 14 '21 15:09 krzysztofmaczynski

Can you find out the problematic template and read raw value from AD?

$ldap = [adsi]"LDAP://$templateDN"
$ldap.Properties["pkikeyusage"]

Crypt32 avatar Sep 14 '21 15:09 Crypt32

Closing as stale. No response from OP.

Crypt32 avatar Sep 18 '23 07:09 Crypt32