[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Search and replace registry value via VBScript

Posted on 2010-08-12
3
Medium Priority
?
864 Views
Last Modified: 2012-08-13
Search registry for below value via VBScript
"HKEY_CURRENT_USER\Software\Juniper Networks\Network Connect 6.3.0\dsNetworkConnect\logoffonConnect" if DWord is 1

then replace the below Value Dword to 1 or else do nothing

"HKEY_CURRENT_USER\Software\Juniper Networks\Network Connect 6.5.0\dsNetworkConnect\logoffonConnect"
0
Comment
Question by:khalsa70
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 60

Expert Comment

by:HainKurt
ID: 33421953
something like this:

check this: http://ezinearticles.com/?VBScript---Working-with-the-Windows-Registry&id=305615
Const HKEY_CURRENT_USER = &H80000001
Dim objRegistry
Set objRegistry=GetObject("winmgmts:{impersonationLevel=impersonate}!" & strComputer & "rootdefault:StdRegProv")

dim rs
dim rr
dim rv
dim st

rs = "Software\Juniper Networks\Network Connect 6.3.0\dsNetworkConnect"
rr = "Software\Juniper Networks\Network Connect 6.5.0\dsNetworkConnect"
st = "logoffonConnect"

objRegistry.GetStringValue HKEY_CURRENT_USER,rs,st,rv
if rv=1 then 
  objRegistry.SetStringValue HKEY_CURRENT_USER,rv,st,1
end if

Open in new window

0
 

Author Comment

by:khalsa70
ID: 33423102
Getting a error with this script. Cannot figure out the issue
0
 
LVL 60

Accepted Solution

by:
HainKurt earned 2000 total points
ID: 33423467
here is a working sample

I have

HK\Test\
A : SZ
B : DWord

under HKEY_CURRENT_USER
Const HKEY_CURRENT_USER = &H80000001

Dim objRegistry
dim strComputer
strComputer = "."

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

dim rs
dim rr
dim rv
dim st

rs = "HK\Test"
rr = "HK\Test"
str = "B" 'dword value
sts = "A" 'string value

objRegistry.GetDWORDValue HKEY_CURRENT_USER,rs,str,rv
WScript.Echo "B = " & rv

if rv=1 then 
  objRegistry.SetStringValue HKEY_CURRENT_USER,rs,sts,"HK"
  WScript.Echo "set HK"
else
  objRegistry.SetStringValue HKEY_CURRENT_USER,rs,sts,"HainKurt"
  WScript.Echo "set HainKurt"
end if

Open in new window

0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

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

In this article we want to have a look at the directory attributes which are used by Microsoft to store the so called Security Identifiers (SID). These SIDs plays an important role in delegating and granting permissions and in authentication of trus…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

649 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