I need to query the registry on workstations for a binary value, and write
the results to a file (as a string). Here is my code and the spot where it
blows up because the result is not a string. Please help me! Thanks....

PKComputerIP="xxx.xxx.xxx.xxx"
Const HKEY_LOCAL_MACHINE = &H80000002
Set oReg=GetObject("winmgmts:\\" & PKComputerIP & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\EAPOL\Parameters\Interfaces"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
wscript.echo subkey
strSubKeyPath = strKeyPath & "\" & subkey
strValueName = "1"
oReg.GetBinaryValue HKEY_LOCAL_MACHINE,strSubKeyPath,strValueName,strValue

'ERROR IS IN THE NEXT LINE!***********************
wscript.echo strSubKeyPath & "=" & cstr(strValue)
Next

Got it! by PK

PK
Tue Oct 10 12:32:01 CDT 2006

Here is what i did:

PKComputerIP="XXX.XXX.XXX.XXX"
PKBinaryValue=""
Const HKEY_LOCAL_MACHINE = &H80000002
Set oReg=GetObject("winmgmts:\\" & PKComputerIP & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\EAPOL\Parameters\Interfaces"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
wscript.echo subkey
strSubKeyPath = strKeyPath & "\" & subkey
strValueName = "1"
oReg.GetBinaryValue HKEY_LOCAL_MACHINE,strSubKeyPath,strValueName,strValue
For PKLoop = lBound(strValue) to uBound(strValue)
PKBinaryValue=PKBinaryValue & strValue(PKLoop)
Next
wscript.echo PKBinaryValue
Next






"PK" wrote:

> I need to query the registry on workstations for a binary value, and write
> the results to a file (as a string). Here is my code and the spot where it
> blows up because the result is not a string. Please help me! Thanks....
>
> PKComputerIP="xxx.xxx.xxx.xxx"
> Const HKEY_LOCAL_MACHINE = &H80000002
> Set oReg=GetObject("winmgmts:\\" & PKComputerIP & "\root\default:StdRegProv")
> strKeyPath = "SOFTWARE\Microsoft\EAPOL\Parameters\Interfaces"
> oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
> For Each subkey In arrSubKeys
> wscript.echo subkey
> strSubKeyPath = strKeyPath & "\" & subkey
> strValueName = "1"
> oReg.GetBinaryValue HKEY_LOCAL_MACHINE,strSubKeyPath,strValueName,strValue
>
> 'ERROR IS IN THE NEXT LINE!***********************
> wscript.echo strSubKeyPath & "=" & cstr(strValue)
> Next