Windows Develop Bookmark and Share   
 index > Windows Forms Designer > How can i get the serial number of Hard disk or mainboard
 

How can i get the serial number of Hard disk or mainboard

hi
i want to program a software lock for my application and i want to know How can i get the serial number of Hard disk or mainboard or any suggestion for software lock in vb.net
thank you so much
MigrationUser 1  Friday, January 21, 2005 2:04 PM
Hi,

You can achive it using WMI. 
You will have to add a reference to System.Management.dll (that come with the framework) and then with something like this:

using System.Management;
...

public string GetDiskSerialNumber() {
  ManagementClass mc = new ManagementClass ( "Win32_LogicalDisk" ) ;
  ManagementObjectCollection disks = mc.GetInstances( ) ;

  foreach ( ManagementObject disk in disks ) {
    if( disk["Name"] == "C:" ) {
       return disk ["VolumeSerialNumber"].ToString();
    }
  }
  return null;
}

You can check for other properties of each of the WMI classes on MSDN, just check WMI.
Hope it helps,
MigrationUser 1  Saturday, January 22, 2005 5:49 AM
thank you goncalo.borrega for reply but i want to know is any way to get the manufacture serial number of hard ?
MigrationUser 1  Saturday, January 22, 2005 1:46 PM

You can use google to search for other answers

Custom Search

More Threads

• How to redraw user control's contest
• Control properties locked for inherited forms
• locked property of visual basic v6.0 in visual basic.net
• Deleted Control is not Visible on DesignSurface after Undo operation
• Shadows Property Problem
• problem with coding voice activated
• WinForms 2005 - "Ctrl" drag on a form design.
• Font Change
• Datagrid User Control
• Hiding Inherited Control's Properties