Re: Working with binary registry values



hi Brimbadan,

I'm not sure I understood exactly what you said, but you may
have run into a "bug" in vbScript, when writing a binary
registry value.

As best I can recall, you can only write a maximum of 8 chars.

You can probably verify this if you want, by searching the
archives of this ng:

http://groups.google.com/advanced_group_search

If that is indeed the problem you are having, then it is
unlikely that microsoft is ever going to fix it.

As an alternative, you could make up a "reg" file, with
the correct constant you wish install in the registry,
and then use shell.run to run the regedit utility, with
the "reg" file as a parameter.

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)




brimbadan@xxxxxxxxx wrote:
Hello! I'm having an issue working with binary registry values in a
vbscript I'm trying to write. I'm aware of how to retrieve a binary
value in vbscript using the getbinaryvalue method (and using an array
to return the value). What I would like to do with the value that is
returned is see if it is a certain value, and if it is perform a
certain operation. The script reads as so now:

Const HKLM = &H80000002
strComputer = "."
strKeyPath = "SOFTWARE\Microsoft\SMS"
strValName = "Intrusive"

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")

oReg.GetBinaryValue HKLM,strKeyPath, _
strValName,strVal

For i = lBound(strVal) to uBound(strVal)
wscript.echo strVal(i)
Next

If strVal(i) = 9 then
wscript "true"
Else
wscript "false"
End if

The problem is when the script runs the if then arguement at the end,
it throws back an error saying the array is out of range. I would
think if it can retrieve the decimal value (using the current array
boundaries) without a problem, why can't it use the decimal value it
returns in an arguement? Also, is there a way to increment the binary
value when writing to it? (in numerical order eg.. 1,2,3). Any help
would be much appreciated. Thank you.

-Dan

.



Relevant Pages

  • Run External Program From VBScript
    ... I need to export certain registry keys from the registry through a vbscript. ... My script reads them into an array. ...
    (microsoft.public.scripting.vbscript)
  • Re: VBscript Array Split Function
    ... inputted into an array so that each separate character in the array is ... make sense and can't be handled properly by VBScript. ... Dim strValue, strChar, k, arrChars() ...
    (microsoft.public.scripting.vbscript)
  • Re: problems with binary types in an ADO recordset
    ... I'm having problems extracting values from binary types in VBscript. ... You can't directly address individual array elements, ... Dim strTemp ... ' Convert Byte-Array to VBScript ANSI string. ...
    (microsoft.public.scripting.vbscript)
  • Re: Make vbScript An Exe
    ... The problem is I don't know vb at all, and I'm pretty good at vbscript. ... an array for reference ... Call GetGroupInfo ' Fill the array with Group Membership ... Sub GetGroupInfo() ...
    (microsoft.public.vb.general.discussion)
  • still looking for real solution to VBScript->C# array params
    ... say to declare the incoming array param as an object rather than an array -- ... curious "variable uses an automation type not supported in VBScript" error. ... servers and have existing ASP code work as-is. ... It was bad enough I had to change all of my string params to object ...
    (microsoft.public.dotnet.framework.interop)