Script can't handle large number of user certificates
jtrott opened this issue · 0 comments
jtrott commented
I have a user (used as the service account for NDES) that currently has 1191 user certificates in the Published Certificates tab.
Here's the sanitised output of running your script:
PS C:\WINDOWS\system32> Get-ADUserCertificate -searchtype SamAccountNameOrCN -searchentry "svc_ndes"
WARNING: no certificate in UserSMIMECertificate attribute for object CN=svc_ndes,OU=Service accounts,OU=Users,DC=domain,DC=local
new-object : Cannot find an overload for "X509Certificate2" and the argument count: "1191".
At C:\Dancrai\Scripts\Get-ADUserCertificate.psm1:146 char:21
- ... $cer2 = new-object System.Security.Cryptography.X509Certificates. ...
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (:) [New-Object], MethodException
- FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
WARNING: no certificate in UserCert attribute for object CN=svc_ndes,OU=Service accounts,OU=Users,DC=domain,DC=local