1

I have a code which checks for a registry key value that exists or not. It only works on none binary values, if the target path is a binary value then it can not checks for it and will tell that the key does not exists.

Here is the Code:

Const HKEY_CURRENT_USER = &H80000001

strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & _ 
    strComputer & "\root\default:StdRegProv")

strKeyPath = "System\CurrentControlSet\Control\Stranger"
strValueName = "TargetBinaryKey"
objRegistry.GetStringValue HKEY_CURRENT_USER,strKeyPath,strValueName,strValue

If IsNull(strValue) Then
WScript.Echo "The Key Does Not Exists."
Else
WScript.Echo "The Key Exists."
End If

What should I do?

1 Answer 1

1

You should use .enumValues instead of .GetStringValue. You can find a code snippet here

Addition: you could also use GetBinaryValue if you know at forehand that the value is stored as binary

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks For your Reply AutomatedChaos. It is working well. Nice Job ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.