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

Harddrive or Motherboard Serial number

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
* "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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.