none
X509Store in VBScript RRS feed

  • Question

  • Hi All,

    I need to move a certificate from one store to another. I have this working in PowerShell, but need to use VBScript for <reasons>.

    It seems so trivial in PowerShell, but I just can't get my head around it in VBScript (A Long Time Ago...).

    So here's the PowerShell... Anyone help?

    $storeMY = new-object System.Security.Cryptography.X509Certificates.X509Store("MY","localmachine")
    $storeTP = new-object System.Security.Cryptography.X509Certificates.X509Store("TrustedPublisher","localmachine")
    $storeMY.Open("MaxAllowed")
    $storeTP.Open("MaxAllowed")
    $cert = $storeTP.certificates | ?{$_.subject -eq "subject goes here"}
    if ($cert)
    {
    	$storeTP.Remove($cert)
    	$storeMY.Add($cert)
    }
    $storeMY.Close()
    $storeTP.Close()

    • Moved by Bill_Stewart Tuesday, October 18, 2016 2:19 PM This is not "convert script to different language for me" forum
    Friday, September 16, 2016 10:45 AM

All replies