[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Edit Reg_binary with VBScript?

Posted on 2008-11-17
8
Medium Priority
?
1,669 Views
Last Modified: 2013-11-26
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!
0
Comment
Question by:seopro
  • 4
  • 3
7 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 22980590
In what way are you wanting to edit it...?
0
 

Author Comment

by:seopro
ID: 22980629
Thanks for your response!I'd like to add value without deleting the current value.
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 22980659
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:seopro
ID: 22981195
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
 
LVL 67

Accepted Solution

by:
sirbounty earned 2000 total points
ID: 22981599
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
 

Author Comment

by:seopro
ID: 22983786
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
 
LVL 67

Expert Comment

by:sirbounty
ID: 22984222
Use another constant... ;^)

const HKEY_CURRENT_USER = &H80000001

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question