Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Search Registry for value in unknown key

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Search Registry for value in unknown key
  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 >>
 Search Registry for value in unknown key - 10/15/2008 2:26:23 AM   
  josh1984

 

Posts: 4
Score: 0
Joined: 10/15/2008
Status: offline
 
Hello,

I'm very new at VBScript. After using goodle and this forum I've pieced together parts of different scripts. I'm at a dead end with my brain melting. I know this can't be a hard as i'm making it out to be. I'm tring to find  if a registry exists to see if a machine has a CD-Burner in it. I found the registry key and all looked great execpt that the Drive is identified with a GUID. So from machine to machine my script is useless. The key is always located in "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CD Burning\Drives\??GUID identifing drive??\MaxCDWriteSpeed" Below the script would return Key exists with value of 48.

Thanks for anyhelp.

Joshua B

Const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & _
   strComputer & "\root\default:StdRegProv")

strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Explorer\CD Burning\Drives\Volume{41b1a9eb-7f6a-11dd-b826-806d6172696f}"
strValueName = "MaxCDWriteSpeed"
objRegistry.GetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,strValue
If IsNull(strValue) Then
   Wscript.Echo "The registry key does not exist."
Else
   Wscript.Echo "The registry key exists. ("& strValue &")"
End If
 
 
Post #: 1
 
 RE: Search Registry for value in unknown key - 10/15/2008 3:15:25 AM   
  dm_4ever


Posts: 2669
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
Are you going to be running this locally or remotely on workstations?

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to josh1984)
 
 
Post #: 2
 
 RE: Search Registry for value in unknown key - 10/15/2008 4:00:29 AM   
  josh1984

 

Posts: 4
Score: 0
Joined: 10/15/2008
Status: offline
I'm going to run this locally. If possible, and thanks for replying. I've also been tring to see if I could't search for whats  below HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CD Burning\Drives\ and save that as a varaible.

(in reply to dm_4ever)
 
 
Post #: 3
 
 RE: Search Registry for value in unknown key - 10/15/2008 4:22:28 AM   
  dm_4ever


Posts: 2669
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
I believe it should be something like this, though I can't test if it does detect a burner since this machine at work does not have one.


      

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to josh1984)
 
 
Post #: 4
 
 RE: Search Registry for value in unknown key - 10/15/2008 6:06:45 AM   
  josh1984

 

Posts: 4
Score: 0
Joined: 10/15/2008
Status: offline
That exactly what I was looking for. I'm glad you have the time to look at this. Now instead of just giving back echos. I'm having it write back to the registry. It writes the value fine for one instance like if null. But if I add it to the Else it gives me name redefined errors. And after reading google seems i'm tring to run the same code twice in the same namespace and need to use name ticks. But I can't get it to work right. I just left it as is so you could see what i'm tring to do. I thought if I named the value string differently it would work but nope.


      

(in reply to dm_4ever)
 
 
Post #: 5
 
 RE: Search Registry for value in unknown key - 10/15/2008 6:28:25 AM   
  josh1984

 

Posts: 4
Score: 0
Joined: 10/15/2008
Status: offline
I got it going I just kept renaming everything. Thanks for everything you're done many blessing upon you.

Joshua B


      

(in reply to josh1984)
 
 
Post #: 6
 
 RE: Search Registry for value in unknown key - 10/15/2008 7:45:50 AM   
  dm_4ever


Posts: 2669
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
The reason for the error has to do with where you declare the variables (Dim)...normally you want to declare them before going into loops since you'll tend to see the error you were getting.

i.e.

      

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to josh1984)
 
 
Post #: 7
 
 
 
  

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 >> Search Registry for value in unknown key 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