Share via


Get Machine ID in C#

Question

Tuesday, January 13, 2009 4:17 AM

 Hi

        I want to get each user Machine's ID through C# and send it to the server for some licensing part of my product.

        How can i do this.

        I want  the machine id is like : "50DE-A239"

Thanks

__DasDwipayan Das

All replies (4)

Tuesday, January 13, 2009 4:20 AM âś…Answered

This might help! 

// Sample for the Environment.MachineName property
using System;

class Sample
{
    public static void Main()
    {
    Console.WriteLine();
//  <-- Keep this information secure! -->
    Console.WriteLine("MachineName: {0}", Environment.MachineName);
    }
}

-- Please mark as asnwer if it solves your problem


Tuesday, January 13, 2009 4:25 AM

Thanks Akhsay

If you dont mind can i ask a question  regarding migrating my old application for Vista OS ?

its a hard time i am having for migrating for Vista .

It worked for me.

Dwipayan Das


Tuesday, January 13, 2009 10:28 AM

sure , go ahead!


Thursday, November 17, 2011 7:56 AM

You can use Machine ID dll for dot net , its very good API .also it retrieve activation
for machine ID, it works with x68,x64.
It has a good feature let you have a different activation code for the same machine ID

Imports Machine
Imports Machine.MachineInfo

Public Class DisplayMachineId

Private Sub DisplayMachineId_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Creating machine object
Dim MyMachine As MachineInfo = New MachineInfo
'***************************HardDisk************** **************

' Dimension array of all HardDisks Information in the computer.
Dim MyHardDisks() As HardDiskIfo
'Fill HardDisk Information object
MyHardDisks = MyMachine.HardDisks
'Assigning the first Hard Disk Model to its TextBox
TxtHardDiskModel.Text = MyHardDisks(0).model
'***************************MachineID************* ***************


'Dimension Components information for Computer ID contains eight components.
Dim MyId As MachineidComponentsInfo
'Fill MachineID component information object.
MyId = MyMachine.MachineIdComponents
'Assigning the eight Machine ID component to its corresponding TextBox
TxtMIComponent1.Text = MyId.Component1
TxtMIComponent2.Text = MyId.Component2
TxtMIComponent3.Text = MyId.Component3
TxtMIComponent4.Text = MyId.Component4
TxtMIComponent5.Text = MyId.Component5
TxtMIComponent6.Text = MyId.Component6
TxtMIComponent7.Text = MyId.Component7
TxtMIComponent8.Text = MyId.Component8


'**************************Machine Activation Code***********************


' Dimension component information for Activation Code contains eight components.
Dim MyActivation As MachineActivationComponentsInfo
'Fill Activation code component information object.It takes four strings parameters to have variety for Activation Code for different versions.
MyActivation = MyMachine.MachineActivationComponents("TypeAnyText", "TypeAnyText", "TypeAnyText", "TypeAnyText")
'Assigning the eight Activation Code components to their corresponding TextBox.
TxtMAComponent1.Text = MyActivation.Component1
TxtMAComponent2.Text = MyActivation.Component2
TxtMAComponent3.Text = MyActivation.Component3
TxtMAComponent4.Text = MyActivation.Component4
TxtMAComponent5.Text = MyActivation.Component5
TxtMAComponent6.Text = MyActivation.Component6
TxtMAComponent7.Text = MyActivation.Component7
TxtMAComponent8.Text = MyActivation.Component8

End Sub
End Class 

This is link for dll
http://dllstore.net/.../MachineId.aspx