Hey!!
I am trying to get information from the registry, but the problem is that the key I am looking for is 2 levels deep of random named keys, so I need to do a "For each subkey
" and inside that For, another "For each subkey" before I den can read out the description.
Thing is, I can get the info from the first keys, but I can't get down to the second keys.
Please help
Thx
Daniel
Here is the code:
The key I want is for a tape station installed on a W2003 server.
*********************************************************
const HKEY_LOCAL_MACHINE = &H80000002
Set wshshell = WScript.CreateObject("WScript.Shell")
strComputer = wshshell.regread("HKLM\SYSTEM\CURRENTCONTROLSET\CONTROL\COMPUTERNAME\COMPUTERNAME\COMPUTERNAME")
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SYSTEM\CurrentControlSet\Enum\SCSI"
objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
On Error Resume next
For Each subkey In arrSubKeys
strKeyPath = "SYSTEM\CurrentControlSet\Enum\SCSI" & subkey
objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath1, arrSubKeys1
For Each sub2key In arrSubKeys1
MsgBox sub2key
MsgBox "Key: " & wshshell.regread("HKLM\SYSTEM\CurrentControlSet\Enum\SCSI\" & subkey & sub2key & "\DeviceDesc")
Next
Next
MsgBox "Done
I am trying to get information from the registry, but the problem is that the key I am looking for is 2 levels deep of random named keys, so I need to do a "For each subkey
" and inside that For, another "For each subkey" before I den can read out the description.
Thing is, I can get the info from the first keys, but I can't get down to the second keys.
Please help
Thx
Daniel
Here is the code:
The key I want is for a tape station installed on a W2003 server.
*********************************************************
const HKEY_LOCAL_MACHINE = &H80000002
Set wshshell = WScript.CreateObject("WScript.Shell")
strComputer = wshshell.regread("HKLM\SYSTEM\CURRENTCONTROLSET\CONTROL\COMPUTERNAME\COMPUTERNAME\COMPUTERNAME")
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SYSTEM\CurrentControlSet\Enum\SCSI"
objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
On Error Resume next
For Each subkey In arrSubKeys
strKeyPath = "SYSTEM\CurrentControlSet\Enum\SCSI" & subkey
objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath1, arrSubKeys1
For Each sub2key In arrSubKeys1
MsgBox sub2key
MsgBox "Key: " & wshshell.regread("HKLM\SYSTEM\CurrentControlSet\Enum\SCSI\" & subkey & sub2key & "\DeviceDesc")
Next
Next
MsgBox "Done