Re: Working with binary registry values
- From: mr_unreliable <kindlyReplyToNewsgroup@xxxxxxxxxxx>
- Date: Wed, 25 Apr 2007 12:57:40 -0400
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
- References:
- Working with binary registry values
- From: brimbadan
- Working with binary registry values
- Prev by Date: Re: Remote Desktop activation
- Next by Date: Event Log Query
- Previous by thread: Working with binary registry values
- Next by thread: Re: Working with binary registry values
- Index(es):
Relevant Pages
|