Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbscript "intermediate certification authorities"

Status
Not open for further replies.

RockJona

Programmer
Nov 14, 2008
7
AR
Hi all,
I've been tryed to found an example of vbs code to retrieve a list of the "intermediate certification authorities", but I haven't find anything yet... if you know something please your help will be so important.

when you run a mmc an add the snap in "certificates (local)", then expand "intermediate certification authorities" being there expand "certificates", well that list which appears, I need to export.

please if you don't understand something... ask me... thxk again

Sorry my english, I'm from argentina, and I don't speak english as good as I used to...
 
Hi,

first ensure that capicom.dll is registered on your systems.
If it's not there, you can get it here: This is the SDK, maybe you can extract the capicom.dll and copy it to the machines + register - not sure, just test it.

Then use this script:

' *********** SCRIPT START ***********************
Const CAPICOM_CA_STORE = "CA"
Const CAPICOM_CURRENT_USER_STORE = 2
Const CAPICOM_STORE_OPEN_READ_ONLY = 0

Set Wshshell = CreateObject("Wscript.shell")
Set Wshfile = CreateObject("Scripting.FileSystemObject")
computername = WshShell.ExpandEnvironmentStrings("%COMPUTERNAME%")

Set oStore = CreateObject ("CAPICOM.Store")
oStore.Open CAPICOM_CURRENT_USER_STORE, CAPICOM_CA_STORE, CAPICOM_STORE_OPEN_READ_ONLY
WScript.Echo " server name: " & computername

For Each oCert in oStore.Certificates
cn = Split(oCert.SubjectName,",")
sn = Split(cn(0),"=")
certname = sn(1)
validto = Split(oCert.ValidToDate," ")
expirationdate = validto(0)
WScript.Echo " CertName: " & certname
WScript.Echo " Valid To: " & expirationdate
WScript.Echo "---------------------"
Next

Set Wshshell = nothing
Set Wshfile = nothing
Set oStore = Nothing
' *********** SCRIPT END***********************





Hope this helps,
DoTheCSharp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top