View Full Version : Persist Registry Entries On Uninstall

01-01-2003, 04:57 PM

For a projet I'm actually working on, a requirement was to store the install date in the registry then leave it when uninstalling (weak protection).

I searched the KB and forums and never found a easy way to achieve this. So I tried with Custom Actions and VBScript.

Here is the VBScript I just to do the job :

Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.RegWrite "HKLM\SOFTWARE\Company Name\Product Name\", "Default"
Dim dateStr
dateStr = DatePart("yyyy",date)
If DatePart("m",date) < 10 Then
dateStr = dateStr & "0" & DatePart("m",date)
dateStr = dateStr & DatePart("m",date)
End If

If DatePart("d",date) < 10 Then
dateStr = dateStr & "0" & DatePart("d",date)
dateStr = dateStr & DatePart("d",date)
End If
WSHShell.RegWrite "HKLM\SOFTWARE\Company Name\Product Name\InstallDate", dateStr
Set WSHShell = nothing

Hope this will help some of you.

01-06-2003, 04:49 PM
Thanks for sharing this!