jayy66 Posted August 25, 2006 Posted August 25, 2006 (edited) I'm trying to retrieve values from a remote registry. I have successfully connected to the remote computer using WMI (system.management). I have an error in my code below. Dim strKeyPath As String = "Software\VB and VBA Program Settings\Current" Dim Values() As String Dim options As New ConnectionOptions options.Username = "username" options.Password = "password" Dim scope As New ManagementScope("\\" + PCname + "\root\default", options) scope.Options.EnablePrivileges = True scope.Options.Impersonation = ImpersonationLevel.Impersonate scope.Connect() If scope.IsConnected Then 'Dim objClass As New ManagementClass(scope, New ManagementPath("StdRegProv"), Nothing) Dim objClass As New ManagementClass("StdRegProv") objClass.Scope = scope Dim objBase As ManagementBaseObject objBase = objClass.GetMethodParameters("GetStringValue") objBase.SetPropertyValue("hDefKey", CType("&H" & Hex(RegistryHive.CurrentUser), Long)) objBase.SetPropertyValue("sSubKeyName", strKeyPath) objBase.SetPropertyValue("sValueName", "Name") objBase = objClass.InvokeMethod("GetStringValue", objBase, Nothing) Values = CType(objBase.Properties.Item("sValue").Value, String()) Does anyone see the error in my code?? Nothing ever gets set into Values. Edited August 26, 2006 by PlausiblyDamp Quote
jayy66 Posted August 29, 2006 Author Posted August 29, 2006 I figured it out. Vb And Vba Program Settings didn't exist for the computer i was testing on. Duh Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.