473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Harddrive or Motherboard Serial number

I have been trying to write a code that will enable me get
the serial number of the motherboard or harddrive on a
given system but no luck so far. Can any one out there
help me.
Nov 20 '05 #1
3 7684
Hi,

Add a reference to system.management.dll.

Dim moReturn As Management.ManagementObjectCollection

Dim moSearch As Management.ManagementObjectSearcher

Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_LogicalDisk'")

moReturn = moSearch.Get

For Each mo In moReturn

Dim VolumeName As String = mo("Volumename")

Dim SerialNumber As String = mo("Volumeserialnumber")

Dim strOut As String = String.Format("{0} - {1}", VolumeName, SerialNumber)

Debug.WriteLine(strOut)

Next

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_Processor")

moReturn = moSearch.Get

For Each mo In moReturn

Debug.WriteLine(mo("ProcessorID"))

Next

Ken

----------------

"Abubakar" <xv************@yahoo.co.uk> wrote in message
news:01****************************@phx.gbl...
I have been trying to write a code that will enable me get
the serial number of the motherboard or harddrive on a
given system but no luck so far. Can any one out there
help me.

Nov 20 '05 #2
* "Abubakar" <xv************@yahoo.co.uk> scripsit:
I have been trying to write a code that will enable me get
the serial number of the motherboard or harddrive on a
given system but no luck so far. Can any one out there
help me.


Harddisk volume number:

Add a reference to "System.Management.dll", then import the namespace
'System.Management' and use this code to get info about the volume
(including the serial number):

\\\
Dim disk As New ManagementObject( _
"Win32_LogicalDisk.DeviceID=""C:""" _
)
Dim diskProperty As PropertyData
For Each diskProperty In disk.Properties
Console.WriteLine( _
"{0} = {1}", _
diskProperty.Name, _
diskProperty.Value _
)
Next diskProperty
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3
Addendum:

If you want to use WMI, have a look at the classes 'Win32_DiskDrive' and
'Win32_BaseBoard'.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: tom | last post by:
Hi, How do I get the serial number of the harddisk in .NET? I want this to be the same number even if the user has reformatted, so I do not want the volume serial number. Thanx, t
3
by: Evgeny Zoldin | last post by:
Hi ALL, how can I get serial number of harddrive using "pure" .NET, without Win API? Thanx
5
by: | last post by:
Hi, Do memory sticks have serial numbers like harddrives? If so how can I get this, I want to uniquely identify a memory stick (removable drive) for authentication. Thanks
2
by: Job Lot | last post by:
How can I retrieve the Motherboard, hard drive, NIC Serial Number Using vb.net. thanx
2
by: Abubakar | last post by:
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?
3
by: bayazee | last post by:
Hi, How can I get CPU Serial number , or motherboard serial number with C . I need an idetification of a computer .... ThanX --------------------------------------------------- iranian python...
4
by: PBI | last post by:
I would like to know if it is possible to read, through php, the Hard Disk Serial Number or other serial number (cpu, motherboard etc... ). Thanks.
0
Airslash
by: Airslash | last post by:
Hello, I've written a class that resembles a hard drive. I'm already able using the Windows API to get information such as the remaining free bytes, the sectors and clusters,a nd it all works...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.