Share via

Get-Certificate cmdlet failed

Petr Synek 6 Reputation points
2022-06-14T12:59:02.48+00:00

I need to issue a certificate for a server. I run these commands:
$cred = Get-Credential Get-Certificate -Template Templatename -CertStoreLocation Cert:\LocalMachine\My -Credential $cred
But after the second command I get this error:
Get-Certificate :
At line:1 char:1
+ Get-Certificate -Template Templatename -CertStoreLocation Cert:\LocalMachine\ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-Certificate], ParameterBindingException
+ FullyQualifiedErrorId : RuntimeException,Microsoft.CertificateServices.Commands.GetCertificateCommand
What's this? I mean, there's no description of the error. What's wrong? Is that something in the command syntax, is something wrong with the server, with the network... How do I solve this?

Windows for business | Windows Client for IT Pros | Directory services | Active Directory
Windows for business | Windows Server | User experience | PowerShell
Windows for business | Windows Server | User experience | Other

5 answers

Sort by: Most helpful
  1. mr.Eilsafin 1 Reputation point
    2025-04-01T12:58:53.29+00:00
    Get-Certificate -Template 'Templatename' -CertStoreLocation 'cert:\LocalMachine\My' -Credential (get-credential)  
    

    And check you rights for this cert template.

    Was this answer helpful?

    0 comments No comments

  2. rr-4098 2,291 Reputation points
    2022-06-20T14:31:13.693+00:00

    Was this answer helpful?


  3. rr-4098 2,291 Reputation points
    2022-06-19T09:17:49.097+00:00

    What OS is the server running? If possible see if you can upgrade Powershell to 5.1.

    Was this answer helpful?


  4. Rich Matheisen 48,116 Reputation points
    2022-06-17T14:43:51.767+00:00

    If you look at the properties of the template "Templatename", do you have permission to "Read" and "Enroll" using the template (either explicitly or through security group membership)?

    Was this answer helpful?


  5. rr-4098 2,291 Reputation points
    2022-06-15T18:42:55.757+00:00

    Are you getting any error codes like 0x<RandomNumbersandLetters>?

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.