PSPKI icon indicating copy to clipboard operation
PSPKI copied to clipboard

Get-CATemplate throws an error "New-Object : Exception calling ".ctor" with "1" argument(s): "There is no such object on the server."

Open miasik opened this issue 3 years ago • 3 comments

It looks similar to #160

PS C:\Users\QQQ> Get-CertificationAuthority | Get-CATemplate -Debug
New-Object : Exception calling ".ctor" with "1" argument(s): "There is no such object on the server.
"
At C:\Users\QQQ\Documents\WindowsPowerShell\Modules\PSPKI\3.7.2\Server\Get-CATemplate.ps1:14 char:4
+             New-Object PKI.CertificateServices.CATemplate -ArgumentLi ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvocationException
    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand

miasik avatar Dec 27 '21 12:12 miasik

I think this is a different issue. The error is thrown from LDAP accessor. It may indicate that CA has assigned a certificate template which no longer exist in Active Directory. If you open your CA in MMC and navigate to Certificate Templates folder you should see a template with red cross on template icon.

Crypt32 avatar Dec 27 '21 17:12 Crypt32

I've just checked. No, I don't have a red cross over our assigned template's icons изображение

miasik avatar Dec 28 '21 07:12 miasik

then it is something with AD. Here is where CATemplate attempts to find the certificate template in AD: https://github.com/PKISolutions/pkix.net/blob/f77ec6d1e4d23ac87a6a427b835724839b10f856/PKI/CertificateServices/CATemplate.cs#L77 and the exception is most likely thrown there.

Crypt32 avatar Dec 29 '21 14:12 Crypt32

Closed as non-reproducable.

Crypt32 avatar Jan 17 '24 13:01 Crypt32