Set fs = Wscript.CreateObject("Scripting.FileSystemObject")
Set MyFile = fs.OpenTextFile("c:\cert\ficatrustedroot.cer", 1)
Output = ""
Do While MyFile.AtEndOfStream <> true
line = Chr(34) & MyFile.ReadLine & Chr(34)
If MyFile.AtEndOfStream <> true then
line = line & " & _" & Chr(10)
End If
Output = Output & line
Loop
MyFile.Close
Set MyFile = Nothing
Set fs = Nothing
'on error resume next
Dim Str, CEnroll
Set CEnroll =CreateObject("CEnroll.CEnroll.1")
Str = Output
'wscript.echo Output
call CEnroll.installPKCS7(str)
Set CEnroll = Nothing
Hi,
The command line utility certmgr.exe will most likely work better for
you, it is a cryptoAPI/Authenticode tool from MS.
To add a certificate to the "Trusted Root Certification Authorities"
in localMachine:
certmgr.exe -add -c "<cert-file>" -s -r localMachine root
where <cert-file> is the path to the certificate file.
Certmgr.exe is available in codesigningx86.exe, download it from here:
Authenticode for Internet Explorer 5.0
http://www.microsoft.com/downloads/details.aspx?familyid=2b742795-d0f0-4a66-b27f-22a95fcd3425&displaylang=en
More information can be found here:
Certificate Manager Tool (Certmgr.exe)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/html/cpgrfcertificatemanagertoolcertmgrexe.asp
Using CertMgr
http://msdn.microsoft.com/library/en-us/security/security/using_certmgr.asp
--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx
Thanks