By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,238 Members | 1,787 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,238 IT Pros & Developers. It's quick & easy.

Getting either harddrive or motherboard serial number

P: n/a
I have been trying to write a code that will give me the
serial number of a harddrive or that of a motherboard, but
i don't seem to get it right.
Do anybody out there have any idea?
Nov 15 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You need to use WMI check MSDN at this link:

http://msdn.microsoft.com/library/de...oarddevice.asp

using System.Management;

//Connection credentials to the remote computer - not needed if the logged
in account has access
ConnectionOptions oConn = new ConnectionOptions();
oConn.Username = "Administrator";
oConn.Password = "";

System.Management.ManagementScope oMs = new
System.Management.ManagementScope(\\MachineID, oConn);

System.Management.ObjectQuery oQuery = new
System.Management.ObjectQuery("select SerialNumber from Win32_BaseBoard");

ManagementObjectSearcher oSearcher = new
ManagementObjectSearcher(oMs,oQuery);

ManagementObjectCollection oReturnCollection = oSearcher.Get();

foreach( ManagementObject oReturn in oReturnCollection )
{
Console.WriteLine("Serial Number : " +
oReturn["SerialNumber"].ToString());
}

Hope this helps

Ian
"Abubakar" <xv************@yahoo.co.uk> wrote in message
news:01****************************@phx.gbl...
I have been trying to write a code that will give me the
serial number of a harddrive or that of a motherboard, but
i don't seem to get it right.
Do anybody out there have any idea?

Nov 15 '05 #2

P: n/a
I hope that this worked for you.

"Ian Frawley" wrote in message
You need to use WMI check MSDN at this link:

http://msdn.microsoft.com/library/de...oarddevice.asp
using System.Management;

//Connection credentials to the remote computer - not needed if the logged
in account has access
ConnectionOptions oConn = new ConnectionOptions();
oConn.Username = "Administrator";
oConn.Password = "";

System.Management.ManagementScope oMs = new
System.Management.ManagementScope(\\MachineID, oConn);

System.Management.ObjectQuery oQuery = new
System.Management.ObjectQuery("select SerialNumber from Win32_BaseBoard");

ManagementObjectSearcher oSearcher = new
ManagementObjectSearcher(oMs,oQuery);

ManagementObjectCollection oReturnCollection = oSearcher.Get();

foreach( ManagementObject oReturn in oReturnCollection )
{
Console.WriteLine("Serial Number : " +
oReturn["SerialNumber"].ToString());
}

Hope this helps

Ian
"Abubakar" <xv************@yahoo.co.uk> wrote in message
news:01****************************@phx.gbl...
I have been trying to write a code that will give me the
serial number of a harddrive or that of a motherboard, but
i don't seem to get it right.
Do anybody out there have any idea?


Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.