Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


RegRead Key Value

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,1322
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> RegRead Key Value
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 RegRead Key Value - 9/5/2004 3:50:07 PM   
  Komputaz

 

Posts: 2
Score: 0
Joined: 9/5/2004
From:
Status: offline
Hi I'm trying to determine the existance of a KEY in the registry Specifically
HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\EXCHANGE\
This key does not have a Default value specified therefore I get an 80070002 error even when the Actual key is there. Anyone have a why around this problem
whole script is

Set objShell = WScript.CreateObject ("WSCript.shell")
RegKey = objShell.regread("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\EXCHANGE")
If Err.Number then
KEY1 = False
Else
KEY1 = True
End If
 
 
Post #: 1
 
 Re: RegRead Key Value - 9/9/2004 12:28:58 AM   
  devguy

 

Posts: 15
Score: 0
Joined: 7/31/2004
From: USA
Status: offline
The following link shows examples of using WMI to read registry keys:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_tasks_for_scripts_and_applications.asp

(in reply to Komputaz)
 
 
Post #: 2
 
 Re: RegRead Key Value - 9/9/2004 3:52:24 AM   
  jbird

 

Posts: 33
Score: 0
Joined: 6/25/2004
From: USA
Status: offline
You could use the Enumkey method on the Profiles key to place all subkeys in an array and then just use a for loop to cycle through the array to check if it exists. Example.
'************************************************************************************************
'Beginning of Code
Const HKEY_CURRENT_USER = &H80000001
Dim strKey
Dim arrSubKeys()
Dim objReg
Dim strComputer

strComputer = "."
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
strKey = "Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles"
objReg.EnumKey HKEY_CURRENT_USER, strKey, arrSubKeys

'The next section will just go through the array to find the desired key.
For intI = 0 to UBound(arrSubKeys)
If arrSubKeys(intI) = "EXCHANGE" Then
WScript.Echo "EXCHANGE does exist."
End If
Next
'End of Code
'************************************************************************************************
The echo statement could be replaced with any indicator you want to use. For example you could set a variable to true if the Exchange key exists.


Hope this helps,
Jay

(in reply to Komputaz)
 
 
Post #: 3
 
 Re: RegRead Key Value - 9/12/2004 10:36:55 AM   
  Komputaz

 

Posts: 2
Score: 0
Joined: 9/5/2004
From:
Status: offline
Thanks Jay Works a treat

Thanks Again
Gary

(in reply to Komputaz)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> RegRead Key Value Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts