Nezir Zahirović

C# get serial number of your PC motherboard



In this post i will show how you can get your PC motherboard serial number. Btw. this  sort of information can be very useful when you need to create some protection generating a protection for your software product and similar things ;)

One important thing in this post you will need to add reference to System.Menagement dll



We need to add the :

using System.Management;

and in button click event next code:)

private void button1_Click(object sender, EventArgs e)
{
ManagementObjectSearcher MOS = new ManagementObjectSearcher("Select * From Win32_BaseBoard");
foreach (ManagementObject getserial in MOS.Get())
{
label1.Text="Your motherboard serial is : "+ getserial["SerialNumber"].ToString();
}

}
SHARE
    Blogger Comment
    Facebook Comment

12 comments:

  1. Error 2 The type or namespace name 'ManagementObjectSearcher' could not be found (are you missing a using directive or an assembly reference?)

    ReplyDelete
  2. Yes, that's mean that you need to include "System.Menagement dll" into your project.

    "One important thing in this post you will need to add reference to System.Menagement dll"

    ReplyDelete
  3. The post is little bit difficult, but i think i will handle it. The last and the major part is quite difficult for me to apply it easily. Anyway i will try it.
    pst recovery

    ReplyDelete
  4. it shows 000000 in windows xp :(

    ReplyDelete
  5. Hi Researcher J K,
    I wrote this post on my XP OS PC. Are you sure that you use correct code and reference ?

    ReplyDelete
  6. Brilliant! Thank you very much!
    Hendo

    ReplyDelete
  7. I found that this code gives you the serial number of the physical board and not the system serial number.

    If you change the Win32_BaseBoard to Win32_BIOS you can pull the system's serial as set in the BIOS.

    ReplyDelete
    Replies
    1. As a side note, I did this code on Windows 7 Enterprise.

      Delete
    2. Great Bryan, Thanks on your share!

      Delete
  8. Great find, even if it's from 2013. Thanks!

    ReplyDelete