Powershell add certificate based credential to windows credential manager

David Rechtenbach 46 Reputation points
2023-06-30T11:52:10.69+00:00

Hello,

It is possible to add certificate based credential to windows credential manager with powershell or intune? The certificate is located in the device certificate store on a windows 10 client.

Windows for business | Windows Server | User experience | PowerShell
Windows for business | Windows Client for IT Pros | User experience | Other
Microsoft Security | Intune | Other
0 comments No comments
{count} votes

Accepted answer
  1. Limitless Technology 44,781 Reputation points
    2023-06-30T14:07:26.04+00:00

    Hello there,

    To add a certificate-based credential to the Windows Credential Manager using PowerShell, you can use the New-StoredCredential cmdlet. Here's an example of how to do it:

    Open PowerShell with administrative privileges.

    Retrieve the thumbprint of the certificate you want to add as a credential. You can use the following command to list the thumbprints of the certificates installed on your system:

    Get-ChildItem -Path Cert:\CurrentUser\My

    Note down the thumbprint of the certificate you want to use.

    Run the following command to add the certificate-based credential to the Credential Manager:

    $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "username", (Get-Item -Path Cert:\CurrentUser\My\THUMBPRINT).Certificate.PrivateKey

    New-StoredCredential -Target "TargetName" -Credential $cred

    Replace "username" with the username associated with the certificate. Replace "THUMBPRINT" with the actual thumbprint of the certificate. Replace "TargetName" with a name that represents the target for which you're adding the credential (e.g., the website or application).

    The certificate's private key is used as the password for the credential.

    Once the command runs successfully, the certificate-based credential will be added to the Windows Credential Manager.

    I used AI provided by ChatGPT to formulate part of this response. I have verified that the information is accurate before sharing it with you.

    Hope this resolves your Query !!

    --If the reply is helpful, please Upvote and Accept it as an answer–


0 additional answers

Sort by: Most helpful

Your answer

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