I broke down and wrote a vbscript for the registry clean up which seems to work...
On Error Resume Next
const HKEY_LOCAL_MACHINE = &H80000002
const HKEY_CLASSES_ROOT = &H80000000
const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Office\12.0"
DeleteSubkeys HKEY_CURRENT_USER, strKeyPath
strKeyPath = "Software\Microsoft\Office\12.0"
DeleteSubkeys HKEY_LOCAL_MACHINE, strKeyPath
strKeyPath = "SYSTEM\CurrentControlSet\Services\ose"
Deletesubkeys HKEY_LOCAL_MACHINE, strKeyPath
strKeyPath = "SOFTWARE\Microsoft\Office\Delivery\SourceEngine\Downloads"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
If Not InStr(subkey, "0FF1CE}-") = 0 Then
'WScript.Echo subkey
Deletesubkeys HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey
End If
Next
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
If Not InStr(subkey, "0FF1CE") = 0 Then
'WScript.Echo subkey
Deletesubkeys HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey
End If
Next
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UpgradeCodes"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
If Not InStr(subkey, "F01FEC") = 0 Then
'WScript.Echo subkey
Deletesubkeys HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey
End If
Next
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
If Not InStr(subkey, "F01FEC") = 0 Then
'WScript.Echo subkey
Deletesubkeys HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey
End If
Next
strKeyPath = "Installer\Features"
oReg.EnumKey HKEY_CLASSES_ROOT, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
If Not InStr(subkey, "F01FEC") = 0 Then
'WScript.Echo subkey
Deletesubkeys HKEY_CLASSES_ROOT, strKeyPath & "\" & subkey
End If
Next
strKeyPath = "Installer\Products"
oReg.EnumKey HKEY_CLASSES_ROOT, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
If Not InStr(subkey, "F01FEC") = 0 Then
'WScript.Echo subkey
Deletesubkeys HKEY_CLASSES_ROOT, strKeyPath & "\" & subkey
End If
Next
strKeyPath = "Installer\UpgradeCodes"
oReg.EnumKey HKEY_CLASSES_ROOT, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
If Not InStr(subkey, "F01FEC") = 0 Then
'WScript.Echo subkey
Deletesubkeys HKEY_CLASSES_ROOT, strKeyPath & "\" & subkey
End If
Next
strKeyPath = "Installer\Win32Assemblies"
oReg.EnumKey HKEY_CLASSES_ROOT, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
If Not InStr(subkey, "Office12") = 0 Then
'WScript.Echo subkey
Deletesubkeys HKEY_CLASSES_ROOT, strKeyPath & "\" & subkey
End If
Next
Sub DeleteSubkeys(reghive, KeyPath)
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
objReg.EnumKey reghive, KeyPath, arrrSubkeys
If IsArray(arrrSubkeys) Then
For Each strrSubkey In arrrSubkeys
DeleteSubkeys reghive, KeyPath & "\" & strrSubkey
Next
End If
objReg.DeleteKey reghive, KeyPath
End Sub
If you don't feel up to hacking together a script Sysinternals RegDelNull is another option for deleting "difficult" registry keys. And as ever, handle with care, like anything that messes directly with the registry it's a loaded gun and it can do a lot of damage.
Best Answer
Do you know what the sub-keys are in advance? If so you can do it with a .reg file using something like this to delete all sub-keys of Test:
The minus sign at the start of the line tells it to delete that key, full syntax here: http://support.microsoft.com/kb/310516
If not, then you're looking for a script that'll enumerate all the sub-keys and then go through deleting them all one by one. I've got one that'll do this at work, but I'm at home and can't get to it!