hi,
i have code a program that fetche serial numbers from Windows Registry. for that i have implemented a registry searching code. But I am unable to fetche same thing from remote machine...
My snipet of code is here
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim key As String = txtKey.Text
TextBox1.Text = "working... " & vbCrLf
TextBox1.Text = GetMyStrings(key)
End Sub
Private Function GetMyStrings(ByVal key As String) As String
Debug.Assert(key.Length > 0)
Dim i As Integer
Dim k As String
'''''= key & vbCrLf
Dim k1 As String = ""
Dim k2 As String = ""
Dim R As Microsoft.Win32.RegistryKey = Registry.LocalMachine.OpenSubKey(key)
Dim a() As String = R.GetSubKeyNames
k += GetMyKeys(key)
For i = 0 To a.Length - 1
Application.DoEvents()
If a(i) <> "Protected Storage System Provider" And a(i) <> "Classes" And a(i) <> "Remote Desktop" And a(i) <> "Credentials" And a(i) <> "GACChangeNotification" And a(i) <> "NetDDE" And a(i) <> "Installer" Then
k1 = key & "\" & a(i)
If Registry.LocalMachine.OpenSubKey(k1).SubKeyCount > 0 Then
k += GetMyStrings(k1)
Else
k += GetMyKeys(k1)
End If
End If
Next
Return k.ToString
End Function
Private Function GetMyKeys(ByVal key As String) As String
Debug.Assert(key.Length > 0)
Dim i As Integer
Dim k As String = ""
Dim R As Microsoft.Win32.RegistryKey = Registry.LocalMachine.OpenSubKey(key)
Dim a() As String = R.GetValueNames
Dim s, str(), str2(), str3(), str4() As String
For i = 0 To a.Length - 1
If a(i) <> "" Then
str = Split(CStr(a(i)), "Serial")
str2 = Split(CStr(a(i)), "Serializ")
str3 = Split(CStr(a(i)), "VolumeSerialNumber")
str4 = Split(CStr(a(i)), "SerialPort")
If (UBound(str) > 0) Then
If (UBound(str2) > 0 Or UBound(str3) > 0 Or UBound(str4) > 0) Then
k += ""
Else
k += key & " "
k += a(i) & " value is ---->"
s = CStr(R.GetValue(a(i), ""))
k += s & vbCrLf
End If
End If
End If
Next
Return k.ToString
End Function
But there is a problem in this code... i can't fetch licence key of amy Microsoft product.
Please can any one help me to devolop this code......
Best of luck in advance..
Regards
Saumya
"I want to change the world.. but 'HE' dosent give me the source code.."
i have code a program that fetche serial numbers from Windows Registry. for that i have implemented a registry searching code. But I am unable to fetche same thing from remote machine...
My snipet of code is here
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim key As String = txtKey.Text
TextBox1.Text = "working... " & vbCrLf
TextBox1.Text = GetMyStrings(key)
End Sub
Private Function GetMyStrings(ByVal key As String) As String
Debug.Assert(key.Length > 0)
Dim i As Integer
Dim k As String
'''''= key & vbCrLf
Dim k1 As String = ""
Dim k2 As String = ""
Dim R As Microsoft.Win32.RegistryKey = Registry.LocalMachine.OpenSubKey(key)
Dim a() As String = R.GetSubKeyNames
k += GetMyKeys(key)
For i = 0 To a.Length - 1
Application.DoEvents()
If a(i) <> "Protected Storage System Provider" And a(i) <> "Classes" And a(i) <> "Remote Desktop" And a(i) <> "Credentials" And a(i) <> "GACChangeNotification" And a(i) <> "NetDDE" And a(i) <> "Installer" Then
k1 = key & "\" & a(i)
If Registry.LocalMachine.OpenSubKey(k1).SubKeyCount > 0 Then
k += GetMyStrings(k1)
Else
k += GetMyKeys(k1)
End If
End If
Next
Return k.ToString
End Function
Private Function GetMyKeys(ByVal key As String) As String
Debug.Assert(key.Length > 0)
Dim i As Integer
Dim k As String = ""
Dim R As Microsoft.Win32.RegistryKey = Registry.LocalMachine.OpenSubKey(key)
Dim a() As String = R.GetValueNames
Dim s, str(), str2(), str3(), str4() As String
For i = 0 To a.Length - 1
If a(i) <> "" Then
str = Split(CStr(a(i)), "Serial")
str2 = Split(CStr(a(i)), "Serializ")
str3 = Split(CStr(a(i)), "VolumeSerialNumber")
str4 = Split(CStr(a(i)), "SerialPort")
If (UBound(str) > 0) Then
If (UBound(str2) > 0 Or UBound(str3) > 0 Or UBound(str4) > 0) Then
k += ""
Else
k += key & " "
k += a(i) & " value is ---->"
s = CStr(R.GetValue(a(i), ""))
k += s & vbCrLf
End If
End If
End If
Next
Return k.ToString
End Function
But there is a problem in this code... i can't fetch licence key of amy Microsoft product.
Please can any one help me to devolop this code......
Best of luck in advance..
Regards
Saumya
"I want to change the world.. but 'HE' dosent give me the source code.."