Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to know if there is a cmd to copy an existing certificate from one store to another. I am trying to copy a certificate from the Users Intermediate Certification Authorities store (certutils -user -store ca fqdn-HOST-CA) to the machine's Trusted Root Certification Authorities store (certutils -store root fqdn-HOST-CA). I tried piping the cmds together with -addstore but no worky!!

certutil.exe -addstore root | certutil.exe -store -user ca fqdn-HOST-CA

Any ideas? Thanks

share|improve this question

1 Answer 1

up vote 3 down vote accepted

I think using PowerShell might be the way to go.

$srcStoreScope = "CurrentUser"
$srcStoreName = "CA"

$srcStore = New-Object System.Security.Cryptography.X509Certificates.X509Store $srcStoreName, $srcStoreScope
$srcStore.Open([System.Security.Cryptography.X509Certificates.OpenFlags]::ReadOnly)

$cert = $srcStore.certificates -match "sometext"

$dstStoreScope = "LocalMachine"
$dstStoreName = "root"

$dstStore = New-Object System.Security.Cryptography.X509Certificates.X509Store $dstStoreName, $dstStoreScope
$dstStore.Open([System.Security.Cryptography.X509Certificates.OpenFlags]::ReadWrite)
$dstStore.Add($cert[0])

$srcStore.Close
$dstStore.Close

#Write-Output $cert
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.