Photo Gallery
Member List
Search
Calendars
FAQ
Ticket List
Log Out
Forums
Register
Login
My Profile
Inbox
Address Book
My Subscription
My Forums
WMI Accessing Remote Registry
Logged in as: Guest
arrSession:exec spGetSession 2,2,1173
Active Users: There are
0
members and
0
guests.
Users viewing this topic: none
Printable Version
All Forums
>>
[Scripting]
>>
WSH & Client Side VBScript
>> WMI Accessing Remote Registry
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 >>
WMI Accessing Remote Registry -
7/23/2004 6:31:24 AM
wraezor
Posts: 1
Score: 0
Joined: 7/23/2004
From: Canada
Status:
offline
Hey folks,
I'm having trouble with some VBS. I'm trying to retrieve certain values from a remote registry, using WMI. I didn't start from scratch, but am attempting to modify some code I found on TechRepublic, for the same purpose.
I'll post the code here...
'sMachine, user, & pass have valid values already Set oLocator = CreateObject("WbemScripting.SWbemLocator") Set oService = oLocator.ConnectServer(sMachine, "Root\DEFAULT", user, pass) If Err.Number <> 0 Then wscript.echo sMachine & "; Error " & Err.Number & ";" & Err.Description Err.Clear Else Set oRegistry = oService.Get("StdRegProv") aSubkeys = GetSubKeys(sMachine, "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall") For Each Subkey In aSubkeys Err.Clear sPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & Subkey '***** HERE is where the problem is. This EnumValues method '***** turns the last two arrays from uninstantiated to null, '***** rather than populating them. oRegistry.EnumValues HKEY_LOCAL_MACHINE, sPath, aValueNames, aValueTypes '***** HERE is where the error is raised. Says '***** UBound has a Type Mismatch. For iLoop=0 to UBound(aValueNames) If aValueNames(iLoop) = "DisplayName" Then oRegistry.GetStringValue HKEY_LOCAL_MACHINE, sPath, aValueNames(iLoop), sDisplayNameValue oLogFile.WriteLine sDisplayNameValue End If Next Next Set oRegistry = Nothing End If
Any glaring errors?
Thanks,
Wraezor
Post #: 1
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
>> WMI Accessing Remote Registry
Page:
[1]
Jump to:
Select a Forum
All Forums
----------------------
[Welcome]
- - Forum Rules
- - Test Posting Messages
- - New Member Area/Introduction
[Scripting]
- - WSH & Client Side VBScript
- - WSH & Client Side VBScript Tutorial
- - Post a VBScript
- - Windows PowerShell
- - ASP
- - ASP.NET
- - Windows Script Components
[General Forum]
- - Other Programming/Scripting Languages
- - Suggestions & Feedback
- - Off-Topic Lounge
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
Forum Software ©
ASPPlayground.NET
Advanced Edition
2.5.5 ANSI