Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Getting Data of a Registry Value

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Getting Data of a Registry 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 >>
 Getting Data of a Registry Value - 5/14/2008 3:04:46 AM   
  chiltz

 

Posts: 71
Score: 0
Joined: 6/13/2007
Status: offline
Hey All,

The below script was built to grab the data inside each registry value of a registry key.  I get an error on line 17 of "type mismatch / 80041005 / SWbemObjectEx".  My research tells me that the "Get""type of value""Value is what I need, but the error seems to indicate otherwise....any ideas?


      
 
 
Post #: 1
 
 RE: Getting Data of a Registry Value - 5/14/2008 3:10:19 AM   
  chiltz

 

Posts: 71
Score: 0
Joined: 6/13/2007
Status: offline
FYI....there are parts of the script (such as reading computer name from a file) that are in place in the script that will be used later on to expand the usage of the script once the main part works right.

(in reply to chiltz)
 
 
Post #: 2
 
 RE: Getting Data of a Registry Value - 5/14/2008 3:21:44 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
You've got several issues here. First, your cases are mixed up:

      Case REG_SZ
          oReg.GetExpandedStringValue HKEY_CURRENT_USER,strKeyPath, arrValueNames, arrValueTypes , arrValueData
          MsgBox "Name: " & arrValueNames(i) & vbtab & "Data Type: Expanded String" & vbtab & "Data: " & arrValueData

You are trying to use GetExpandedString to get a string. Let's assume you fix that and look at the way that you actually try to call GetStringValue:

oReg.GetStringValue HKEY_CURRENT_USER,strKeyPath, arrValueNames, arrValueTypes , arrValueData


GetStringValue takes 4 parameters:
uint32 GetStringValue(
[in] uint32 hDefKey = 2147483650,
string
sSubKeyName,
string
sValueName,
string
sValue
);


First, you are trying to pass it 5. Next, parameter2 through 4 are strings. For paramter 2 you are indeed passing it a string. For parameter 3 and 4 you are trying to pass it an array. So lets straighten those issues up:

oReg.GetStringValue HKEY_CURRENT_USER,strKeyPath, arrValueNames(i), arrValueData(i)

Ok, now look at that last parameter that you are passing in. You are treating it as an array (at least based on what you named it) but you never actually make it an array. To make it an array that is the same size as the other two arrays that you are using, put this line immediately before the For statement:

ReDim arrValueData(UBound(arrValueNames))

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to chiltz)
 
 
Post #: 3
 
 RE: Getting Data of a Registry Value - 5/14/2008 3:54:36 AM   
  chiltz

 

Posts: 71
Score: 0
Joined: 6/13/2007
Status: offline
Thanks EB....below script works perfectly.  End result will be a script you can specifiy what you want to look for and wether or not you want a single search or a list of machines processed.


      

(in reply to ebgreen)
 
 
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 >> Getting Data of a Registry 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