vb.net envanter programı için gerekli olabilecek bir parça.
Imports Microsoft.Win32
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox(GetXPKey(TextBox1.Text))
End Sub
Public Function GetXPKey(ByVal hostorip As String) As String
Dim MyReg As RegistryKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, hostorip)
Dim MyRegKey As RegistryKey
MyRegKey = MyReg.OpenSubKey("Software\Microsoft\Windows NT\currentVersion", True)
Dim bytDPID() As Byte = MyRegKey.GetValue("DigitalProductID")
MyRegKey.Close()
Dim bytKey(14) As Byte
Array.Copy(bytDPID, 52, bytKey, 0, 15)
Dim strChar As String = "BCDFGHJKMPQRTVWXY2346789"
Dim strKey As String = ""
For j As Integer = 0 To 24
Dim nCur As Short = 0
For i As Integer = 14 To 0 Step -1
nCur = CShort(nCur * 256 Xor bytKey(i))
bytKey(i) = CByte(Int(nCur / 24))
nCur = CShort(nCur Mod 24)
Next
strKey = strChar.Substring(nCur, 1) & strKey
Next
For i As Integer = 4 To 1 Step -1
strKey = strKey.Insert(i * 5, "-")
Next
Return strKey
End Function
End Class
Vb.net remote registry ile bilgisayarın ürün anahtarını bulmak
vb.net kullanarak uzaktaki bilgisayarın ürün anahtarını almak, get remote computer product key using remote registry