Im trying to read all *.p7c files stored in subfolders like this.
- C:\Cert_1\act\cert.p7c
- C:\Cert_2\act\cert.p7c
- C:\Cert_3\act\cert.p7c
and check the ValidTo Date. I only managed to read a single file in a specific folder.
Dim ScriptName
Dim Logdatei
Dim fso
Dim intTage
Const LogDir = "C:\Skript\CheckZert\LOGS"
Set fso = WScript.CreateObject("Scripting.FileSystemObject")
set cert = CreateObject("Chilkat_9_5_0.Cert")
ScriptName = WScript.ScriptName
intTage = 14
Logdatei = Logfile(LogDir)
success = cert.LoadFromFile("C:\Cert\Cert_1\act\cert.p7c")
If (success <> 1) Then
Call Writelog (cert.LastErrorText)
WScript.Quit
End If
If DateDiff("d", Now, cert.ValidTo) < intTage Then
Call Writelog ("Zertifikat: " & cert.SubjectDN)
Call Writelog ("Gültig ab: " & cert.ValidFrom & " Gültig bis: " & cert.ValidTo)
Call Writelog ("Seriennummer: " & cert.SerialNumber)
Call Writelog ("Zertifikat läuft ab am: " & cert.ValidTo)
Else
Call Writelog ("OK")
End If
This works fine but im looking for a way to check all *.p7c files stored in the subfolders.