Posted 24 November 2003 - 17:01
OK, I'm going to get a lot of flack for this on but here it goes any way.
I gave up trying to get all of the ICE Rules happy years ago. Microsoft does not seem to try to adhere to them either and they wrote most of them. I figure I’m safe. The important thing that I have found is does the application installation do what you want it to and is it safe to the targeted system.
I rarely use the RemoveRegistry Table and Action as I prefer the extended control that I get via the vbscript.
The RemoveRegisrty Action does not work on Un-Install but the Script does quite well.
Here is the full Script snipit:
Const HKCU = &H80000001 'HKEY_CURRENT_USER
strComputer = "."
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
DeleteRegistryKey HKCU, "SOFTWARE\Test"
Sub DeleteRegistryKey(hive,key)
On Error Resume Next
rc = oReg.EnumKey(hive,key,arSubKeys)
'WScript.Echo key & " a"
For Each sKey In arSubKeys
If Err Then
'WScript.Echo key & " b"
Err.Description
Err.Clear
rc = oReg.DeleteKey(hive,key)'TEST SET
Exit Sub
End If
'WScript.Echo key & " c"
DeleteRegistryKey hive, key & "\" & sKey
Next
'WScript.Echo key & " d"
rc = oReg.DeleteKey(hive,key)
End Sub
This little ditty will delete the targeted key and all subs.
Regards,
Robert W. Haynie
Software Integration Consultant
robert.haynie@HaynieHouse.com
+1 (713) 805-4830
Be the stone that sharpens the leading edge.