0

hi

I thought this was simple so i guess i am doing something wrong.
I want to read the value of an item in the registry.

the value im after is the centralprofile key which im trying to get by passing the SID and looking up the subkey but it never returns anything.

my code

Function getprofilepath(ByVal SID As String) As String
        Try
            regKey = Registry.LocalMachine.OpenSubKey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\" & SID, False)
            If Not regKey Is Nothing Then
                Return CType(regKey.GetValue("CentralProfile"), String)
            End If
        Catch ex As Exception

        End Try


        Return ""
    End Function

I know that the SID being passed is correct so any thoughts are appreciated.

1
Contributor
1
Reply
2
Views
6 Years
Discussion Span
Last Post by ninjaimp
0

solved it

used this instead

Return Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\" & SID, "CentralProfile", "")
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.