Edit Reg_binary with VBScript?

Hello,
I'm looking for a simple VBScript to edit a REG_BINARY registry value. Please note that I'd like to edit an existing value, I don't need to create a new value.
Thanks in advance!
seoproAsked:
Who is Participating?
 
sirbountyConnect With a Mentor Commented:
Here's a good starter for reading binary values...uses WMI.
Let me know if you need further help with it.

http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/registry/#ReadBinaryRegVal.htm

const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut
 
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ 
strComputer & "\root\default:StdRegProv")
 
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
strValueName = "LicenseInfo"
oReg.GetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,_
strValueName,strValue
 
 
For i = lBound(strValue) to uBound(strValue)
    StdOut.WriteLine  strValue(i)
Next

Open in new window

0
 
sirbountyCommented:
In what way are you wanting to edit it...?
0
 
seoproAuthor Commented:
Thanks for your response!I'd like to add value without deleting the current value.
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
sirbountyCommented:
Basically, you'll need to read the current value, insert your new portion, and rewrite the entire value...
Have an example key of what you're trying to do?
0
 
seoproAuthor Commented:
Thanks for your response.Let's start with reading:I've tried to use regread message and then output it with a msgbox, But received "type mismatch" error.So what's the correct way to read long reg_binary values?
0
 
seoproAuthor Commented:
Thanks!
One question, Though:
const HKEY_LOCAL_MACHINE = &H80000002
What if I need to read HKEY_CURRENT_USER without the root/administrative access?
Thanks in advance!
0
 
sirbountyCommented:
Use another constant... ;^)

const HKEY_CURRENT_USER = &H80000001

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.