Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


strkeypath value from 2 different reg paths

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> strkeypath value from 2 different reg paths
  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 >>
 strkeypath value from 2 different reg paths - 8/31/2008 10:32:31 PM   
  teichheinz

 

Posts: 2
Score: 0
Joined: 8/31/2008
Status: offline
I would like to modify my script to look up strkeypath in two different locations of the registry

first the path with which the script works fine:
SOFTWARE\Comanyname\Softwarename\Version9.3

and now if the above path does not exist I want the script to get the value from this path:
SOFTWARE\Comanyname\Softwarename\Version9.5

Here is the script:

Const HKLM = &H80000002
       strComputer = "."
       Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
       strComputer & "\root\default:StdRegProv")
       strKeyPath = "SOFTWARE\Comanyname\Softwarename\Version9.3"
       strValueName = "Serial Number"
       oReg.GetStringValue HKLM,strKeyPath,strValueName,strValue
 
 
Post #: 1
 
 RE: strkeypath value from 2 different reg paths - 9/1/2008 11:09:56 AM   
  Aracanth

 

Posts: 5
Score: 0
Joined: 8/31/2008
Status: offline
Hi,
Had to do this myself recently... The result from the reg lookup is a 0 for a good lookup (string existed) and non-0 for a failure, (basically). The success/failure can be assigned to a varaible at the same time that the return value can be gained from the parameter to the call. Here was my ver:

errOut = objWMIRegistry.getStringValue (HKLM, strAVRegKey, strAVVerRegEntry, arrInfo (19))
   If errOut <> 0 Then
    errOut = objWMIRegistry.getStringValue (HKLM, strAVRegKey2, strAVVerRegEntry2, arrInfo (19))
   End If
   If errOut <> 0 Then arrInfo (19) = "Check Registry!"


Hope that helped.

Ara

(in reply to teichheinz)
 
 
Post #: 2
 
 
 
  

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 >> strkeypath value from 2 different reg paths 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