|
Posted by =?Utf-8?B?REpI?= on May 22, 2008, 2:07 am
If you were Registered and logged in, you could reply and use other advanced thread options Champion.. thank you,
we have some scripting guys who can hopefully rustle something up. Perhaps
we can work out a way for this script to run against members of a group, the
same group which allows enrollment of the certificate.
cheers for your help - its appreciated!
"Paul Adare" wrote:
> On Wed, 21 May 2008 22:34:00 -0700, DJH wrote:
>
> > we've only just picked this up in our test lab as certs have started to
> > expire, so we have a few weeks to find a workaround for production!
>
> One solution would be to run a scheduled task on your web servers that
> checks the certificate for expiration and then either fires off an email
> notification to those responsible to performing the renwal, or, if you want
> to get really fancy you could also script the renewal. Here's an example
> script to get you started and to show you the types of things you can do
> with CAPICOM:
>
> '**************************************************
> '* CertExpiryCheck.vbs
> '* Enumerate certificates with day left for expiry
> '**************************************************
>
> Option Explicit
> Dim SubjectName
> If WScript.Arguments.Count > 0 Then
> SubjectName = LCase(WScript.Arguments(0))
> Else
> CommandUsage
> End If
>
> Dim Store, Certificates, Certificate
> Const CAPICOM_LOCAL_MACHINE_STORE = 1
> Const CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1
> Const CAPICOM_STORE_OPEN_READ_ONLY = 0
>
> Set Store = CreateObject("CAPICOM.Store")
> Store.Open CAPICOM_LOCAL_MACHINE_STORE, "MY" ,CAPICOM_STORE_OPEN_READ_ONLY
> Set Certificates =
> Store.Certificates.Find(CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME, SubjectName,
> 0)
>
> If Certificates.Count >0 Then
> For Each Certificate in Certificates
> 'Certificate.display() 'If you want to see the Cert in UI
> WScript.Echo "*** Subject " & Certificate.SubjectName & " ***"
> WScript.Echo "Issued by " & Certificate.IssuerName
> WScript.Echo "Valid from " & Certificate.ValidFromDate & " to " &
> Certificate.ValidToDate
> WScript.Echo "Days to expiry " &
> DateDiff("d",now(),Certificate.ValidToDate)
> WScript.Echo
> Next
> Else
> WScript.Echo "No certificates with SubjectName => '" & SubjectName & "'"
> End If
>
> Set Certificates = Nothing
> Set Store = Nothing
>
> Sub CommandUsage
> MsgBox "Usage: CertExpiryCheck.vbs [SubjectName] ",
> vbInformation,"CertExpiryCheck"
> WScript.Quit(1)
> End Sub
> --
> Paul Adare
> http://www.identit.ca
> To err is human; to really foul things up requires a computer.
>
|