dcsimg
Results 1 to 2 of 2

Thread: getting remote registry key - null reference HELP

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2015
    Posts
    9

    getting remote registry key - null reference HELP

    im trying to open a key so i can delete its subkeys

    Code:
             Dim asu As New System.Security.Principal.NTAccount(username.Text)
                        Dim si As System.Security.Principal.SecurityIdentifier = asu.Translate(GetType(System.Security.Principal.SecurityIdentifier))
    
                        Dim MyReg As Microsoft.Win32.RegistryKey
                        MyReg = Microsoft.Win32.RegistryKey.OpenRemoteBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, host.Text) _
                            .OpenSubKey("Software\Microsoft\Windows NT\currentVersion\ProfileList\" & si.ToString & "\")
                        Dim myval As String
                        myval = MyReg.GetValue("Guid")
                        MsgBox(myval.ToString) ' retuns GUID no errors
                        Dim guid As String
                        guid = myval
                        Dim MyReg2 As Microsoft.Win32.RegistryKey
                        MyReg2 = Microsoft.Win32.RegistryKey.OpenRemoteBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, host.Text) _
                            .OpenSubKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileGuid\")
    
    
                        MsgBox(MyReg2.ToString)
                        'myreg2.DeleteSubKey(guid)

    now i have tesedt other keys on the same level

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileNotification

    they all return values but trying to open ProfileGuid returns a Null reference - i have full access to the registry and have tested locally same results

    i know the key exists is they any way i can delete it directly without opening subkeys? or can anyone help why it is returning null?

  2. #2

    Thread Starter
    New Member
    Join Date
    Mar 2015
    Posts
    9

    Re: getting remote registry key - null reference HELP

    ive also tried looping through the top level HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\

    Code:
    Dim SubKeyNames() As String = MyReg2.GetSubKeyNames() For Each s As String In SubKeyNames MsgBox(s.ToString) Next
    i have also given "everyone" full access to the key still returning nothing –

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width