listing multiple regkeys under multiple keys
listing multiple regkeys under multiple keys
listing multiple regkeys under multiple keys
listing multiple regkeys under multiple keys
listing multiple regkeys under multiple keys
listing multiple regkeys under multiple keys listing multiple regkeys under multiple keys listing multiple regkeys under multiple keys listing multiple regkeys under multiple keys listing multiple regkeys under multiple keys listing multiple regkeys under multiple keys listing multiple regkeys under multiple keys listing multiple regkeys under multiple keys
listing multiple regkeys under multiple keys listing multiple regkeys under multiple keys
listing multiple regkeys under multiple keys
Go Back  Xtreme Visual Basic Talk > > > listing multiple regkeys under multiple keys


Reply
 
Thread Tools Display Modes
  #1  
Old 06-13-2012, 07:17 PM
sheetzdw sheetzdw is offline
Newcomer
 
Join Date: Jun 2012
Location: St. Louis, MO
Posts: 2
Default listing multiple regkeys under multiple keys


HI ALL!!
I am noob and this is my first post so be gentle



I am trying to list all printers (Printers\Connections)
under all users (HKEY_USERS)

problem is I dont know the user name keys in advance and need to exclude .DEFAULT and *_CLASSES

so first I need to list all key names (%usernamekey%) directly under HKEY_USERS

then for all keys that lists

lsit all keys under HKEY_USERS\%usernamekey%\Printers\Connections

Here is the code I have so far but I get errors about object variable not set, I suspect because of the way I doing the for each and listing the key names and then doing it again

ANy ideas are appreciated! Many thanks in advance


Code:
    Private Sub DetectPrntrs()
        Try

            Dim RemReg As Microsoft.Win32.RegistryKey
            Dim RemVal As String = ""
            Dim RemUser As String

            RemReg = Microsoft.Win32.RegistryKey.OpenRemoteBaseKey(Microsoft.Win32.RegistryHive.Users, (OldPCTxtBx.Text))

            For Each RemUser In RemReg.GetSubKeyNames
                Dim RemUserRegKey = RemReg.OpenSubKey(RemUser & "\Printers\Connections")
                RemVal = RemUserRegKey.GetSubKeyNames
                RemReg.Close()

            Next
            Dim PrnterKeys = RemVal

            For Each PrntrName As String In PrnterKeys
                If (PrntrName) = ".DEFAULT" Then
                ElseIf (PrntrName) = "_CLASSES" Then
                Else
                    Me.PrintersListBx.Items.Add(PrntrName)
                End If

            Next
        Catch ex As Exception
            WriteLog("DetectPrntrs Error :" & TimeOfDay.ToString & " " & ex.Message)

        End Try
    End Sub
Reply With Quote
  #2  
Old 06-14-2012, 04:45 AM
PlausiblyDamp's Avatar
PlausiblyDamplisting multiple regkeys under multiple keys PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

Is there a reason why you can't just use PrinterSettings.InstalledPrinters to find the installed printers?
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #3  
Old 06-19-2012, 01:09 PM
sheetzdw sheetzdw is offline
Newcomer
 
Join Date: Jun 2012
Location: St. Louis, MO
Posts: 2
Default

Quote:
Originally Posted by PlausiblyDamp View Post
Is there a reason why you can't just use PrinterSettings.InstalledPrinters to find the installed printers?
I dont think that show all printers for all users on remote pc's, does it?
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
listing multiple regkeys under multiple keys
listing multiple regkeys under multiple keys
listing multiple regkeys under multiple keys listing multiple regkeys under multiple keys
listing multiple regkeys under multiple keys
listing multiple regkeys under multiple keys
listing multiple regkeys under multiple keys listing multiple regkeys under multiple keys listing multiple regkeys under multiple keys listing multiple regkeys under multiple keys listing multiple regkeys under multiple keys listing multiple regkeys under multiple keys listing multiple regkeys under multiple keys
listing multiple regkeys under multiple keys
listing multiple regkeys under multiple keys
 
listing multiple regkeys under multiple keys
listing multiple regkeys under multiple keys
 
-->