WeiszMCITP
MIS
Hello,
I am trying to remove a series of registry keys using a VBS script but I am unable to delete the keys that have subkeys. Keys that do not have subkeys delete appropriately. Here is the section of code I am working with.
-------------------------------
Dim strComputer, objRegistry, arrSubkeys, strSubkey
Dim arr_RegKeys(5,0)
arr_RegKeys(0,0) = "Installer\Features\05EF846EB0E72E5429DEBAF14D942339"
arr_RegKeys(1,0) = "Installer\Products\05EF846EB0E72E5429DEBAF14D942339"
arr_RegKeys(2,0) = "Installer\Features\23C393B6EC8A3664D9B5AE578C1D32C3"
arr_RegKeys(3,0) = "Installer\Products\23C393B6EC8A3664D9B5AE578C1D32C3"
arr_RegKeys(4,0) = "Installer\Features\8143882BBE1736F479BA22C2769E3985"
arr_RegKeys(5,0) = "Installer\Products\8143882BBE1736F479BA22C2769E3985"
Const HKEY_CLASSES_ROOT = &H80000000
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
DeleteSubkeys HKEY_CLASSES_ROOT, arr_RegKeys
Sub DeleteSubkeys(HKEY_CLASSES_ROOT, arr_RegKeys)
For i=0 to 5
objRegistry.EnumKey HKEY_CLASSES_ROOT, arr_RegKeys(i,0), arrSubkeys
If IsArray(arrSubkeys) Then
For Each strSubkey In arrSubkeys
DeleteSubkeys HKEY_CLASSES_ROOT, arr_RegKeys(i,0) & "\" & strSubkey
Next
End If
objRegistry.DeleteKey HKEY_CLASSES_ROOT, arr_RegKeys(i,0)
Next
End Sub
--------------------------
If anyone can tell me what I need to do to delete the keys with sub keys I greatly appreciate it.
Thanks!
I am trying to remove a series of registry keys using a VBS script but I am unable to delete the keys that have subkeys. Keys that do not have subkeys delete appropriately. Here is the section of code I am working with.
-------------------------------
Dim strComputer, objRegistry, arrSubkeys, strSubkey
Dim arr_RegKeys(5,0)
arr_RegKeys(0,0) = "Installer\Features\05EF846EB0E72E5429DEBAF14D942339"
arr_RegKeys(1,0) = "Installer\Products\05EF846EB0E72E5429DEBAF14D942339"
arr_RegKeys(2,0) = "Installer\Features\23C393B6EC8A3664D9B5AE578C1D32C3"
arr_RegKeys(3,0) = "Installer\Products\23C393B6EC8A3664D9B5AE578C1D32C3"
arr_RegKeys(4,0) = "Installer\Features\8143882BBE1736F479BA22C2769E3985"
arr_RegKeys(5,0) = "Installer\Products\8143882BBE1736F479BA22C2769E3985"
Const HKEY_CLASSES_ROOT = &H80000000
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
DeleteSubkeys HKEY_CLASSES_ROOT, arr_RegKeys
Sub DeleteSubkeys(HKEY_CLASSES_ROOT, arr_RegKeys)
For i=0 to 5
objRegistry.EnumKey HKEY_CLASSES_ROOT, arr_RegKeys(i,0), arrSubkeys
If IsArray(arrSubkeys) Then
For Each strSubkey In arrSubkeys
DeleteSubkeys HKEY_CLASSES_ROOT, arr_RegKeys(i,0) & "\" & strSubkey
Next
End If
objRegistry.DeleteKey HKEY_CLASSES_ROOT, arr_RegKeys(i,0)
Next
End Sub
--------------------------
If anyone can tell me what I need to do to delete the keys with sub keys I greatly appreciate it.
Thanks!