0

hi and hello i have developed a desktop application and deployed it and it's working fine but what i simply want that my application should be installed in only one particular PC to whom i have sold it out but same setup should not install in other PC. becuase i have concern that my application can be sold out to some other via my clients so what should i do how to get hardware id so that it can be installed only in particular system thx to all

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Jx_Man
0

see if this helps :

imports :

Imports System
Imports System.Management
Imports System.Management.Instrumentation
Imports System.IO
Imports System.Collections

Procedure to get info :

Private Sub getMotherBoardDetails()
        Try
            Dim objMOS As New ManagementObjectSearcher("SELECT * FROM  Win32_BaseBoard")
            Dim objMan As ManagementObject
            For Each objMan In objMOS.Get
                txtCaption.Text = objMan.GetPropertyValue("Caption").ToString()
                txtCreationClass.Text = objMan.GetPropertyValue("CreationClassName").ToString()
                txtDescription.Text = objMan.GetPropertyValue("Description").ToString()
                txtInstallDate.Text = Convert.ToDateTime(objMan.GetPropertyValue("InstallDate"))
                txtManufacturer.Text = objMan.GetPropertyValue("Manufacturer").ToString()
                txtModel.Text = Convert.ToString(objMan.GetPropertyValue("Model"))
                txtName.Text = objMan.GetPropertyValue("Name").ToString()
                txtPartNumber.Text = Convert.ToInt32(objMan.GetPropertyValue("PartNumber"))
                txtEdon.Text = objMan.GetPropertyValue("PoweredOn").ToString()
                txtProduct.Text = objMan.GetPropertyValue("Product").ToString()
                txtSerial.Text = objMan.GetPropertyValue("SerialNumber").ToString()
                txtSKU.Text = Convert.ToString(objMan.GetPropertyValue("SKU"))

                txtStatus.Text = Convert.ToString(objMan.GetPropertyValue("Status"))
                txtTag.Text = Convert.ToString(objMan.GetPropertyValue("Tag"))
                txtVersion.Text = Convert.ToString(objMan.GetPropertyValue("Version"))
                txtWeight.Text = Convert.ToString(objMan.GetPropertyValue("Weight"))
                txtHeight.Text = Convert.ToString(objMan.GetPropertyValue("Height"))
                'txtPoweredon.Text = Convert.ToString(objMan.GetPropertyValue("Model"))
            Next
        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OKOnly, "Koneksi Error !!")
        End Try
    End Sub
    Private Sub getHardiskDetails()
        Try
            Dim objMOS As New ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive")
            Dim objMan As ManagementObject
            For Each objMan In objMOS.Get
                txtHardiskModel.Text = objMan.GetPropertyValue("Model").ToString()
                txtInterfaceType.Text = objMan.GetPropertyValue("InterfaceType").ToString()
                txtHDCreationClass.Text = objMan.GetPropertyValue("CreationClassName").ToString()
                txtHDDescription.Text = objMan.GetPropertyValue("Description").ToString()
                txtHDInstallDate.Text = Convert.ToDateTime(objMan.GetPropertyValue("InstallDate"))
                txtHDManufacturer.Text = objMan.GetPropertyValue("Manufacturer").ToString()
                txtHDName.Text = objMan.GetPropertyValue("Name").ToString()
                'txtHDSerial.Text = objMan.GetPropertyValue("SerialNumber").ToString()
            Next
        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OKOnly, "Koneksi Error !!")
        End Try
    End Sub
    Private Sub getOpticalDetails()
        Try
            Dim objMOS As New ManagementObjectSearcher("SELECT * FROM Win32_CDROMDrive")
            Dim objMan As ManagementObject
            For Each objMan In objMOS.Get

                txtOpCreationClass.Text = objMan.GetPropertyValue("CreationClassName").ToString()
                txtOpDescription.Text = objMan.GetPropertyValue("Description").ToString()

            Next
        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OKOnly, "Koneksi Error !!")
        End Try
    End Sub
    Private Sub getProcessorDetails()
        Try
            Dim objMOS As New ManagementObjectSearcher("SELECT * FROM Win32_Processor")
            Dim objMan As ManagementObject
            For Each objMan In objMOS.Get
                'txtHardiskModel.Text = objMan.GetPropertyValue("Model").ToString()
                txtProcType.Text = Convert.ToInt16(objMan.GetPropertyValue("ProcessorType"))
                txtProcCreationClass.Text = objMan.GetPropertyValue("CreationClassName").ToString()
                txtProcDescription.Text = objMan.GetPropertyValue("Description").ToString()
                txtProcCaption.Text = objMan.GetPropertyValue("Caption").ToString()
                txtProcClockSpeed.Text = Convert.ToInt32(objMan.GetPropertyValue("CurrentClockSpeed"))
                txtProcDeviceID.Text = objMan.GetPropertyValue("DeviceID").ToString()
                txtProcId.Text = objMan.GetPropertyValue("ProcessorId").ToString()
                txtProcArchitecture.Text = Convert.ToInt16(objMan.GetPropertyValue("Architecture"))
                txtProcInstallDate.Text = Convert.ToDateTime(objMan.GetPropertyValue("InstallDate"))
                txtProcFamily.Text = Convert.ToInt16(objMan.GetPropertyValue("Family"))
                'txtProcNumberOfCores.Text = Convert.ToInt32(objMan.GetPropertyValue("NumberOfCores"))

            Next
        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OKOnly, "Koneksi Error !!")
        End Try
    End Sub

Call it on button :

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        getMotherBoardDetails()
        getHardiskDetails()
        'getOpticalDetails()
        getProcessorDetails()
End Sub

you can see the result on pic

Attachments motherboard.png 24.23 KB
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.