Solved

check whether sub key exist?

Posted on 2008-10-09
4
448 Views
Last Modified: 2012-06-22
vbs code to check whether a particular registry key exist or not , any method other than as shown in mentioned link.

http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_23540698.html
0
Comment
Question by:ankur3020
[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
  • 3
4 Comments
 
LVL 5

Expert Comment

by:si_shamil
ID: 22679306
Try this:
Const HKEY_LOCAL_MACHINE = &H80000002
\Level
 
Set objReg = GetObject("winmgmts:\\.\root\default:StdRegProv")
 
objReg.GetDWordValue HKEY_LOCAL_MACHINE, "\Software\Microsoft\Office\11.0\Access\Security", "Level", dwValue
 
If IsNull(dwValue) Then
    Wscript.Echo "The registry key does not exist."
Else
    Wscript.Echo "The registry key exists. (" & dwValue & ")"
End If

Open in new window

0
 
LVL 5

Expert Comment

by:si_shamil
ID: 22679313
I have type, in the script
try this instead:
Const HKEY_LOCAL_MACHINE = &H80000002
 
Set objReg = GetObject("winmgmts:\\.\root\default:StdRegProv")
 
objReg.GetDWordValue HKEY_LOCAL_MACHINE, "\Software\Microsoft\Office\11.0\Access\Security", "Level", dwValue
 
If IsNull(dwValue) Then
    Wscript.Echo "The registry key does not exist."
Else
    Wscript.Echo "The registry key exists. (" & dwValue & ")"
End If

Open in new window

0
 
LVL 5

Assisted Solution

by:si_shamil
si_shamil earned 50 total points
ID: 22679352
Typo again, it is hard to type all in Windows Mobile.. :)
Const HKEY_LOCAL_MACHINE = &H80000002
 
Set objReg = GetObject("winmgmts:\\.\root\default:StdRegProv")
 
objReg.GetDWordValue HKEY_LOCAL_MACHINE, "Software\Microsoft\Office\11.0\Access\Security", "Level", dwValue
 
If IsNull(dwValue) Then
    Wscript.Echo "The registry key does not exist."
Else
    Wscript.Echo "The registry key exists. (" & dwValue & ")"
End If

Open in new window

0
 

Accepted Solution

by:
ankur3020 earned 0 total points
ID: 22679677
thanks, they are ok.
0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

707 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