|
-
Apr 16th, 2004, 11:16 AM
#1
Thread Starter
Frenzied Member
Get HDD Serial with .Net
What is the easiest way to get some machine specifice serial number with VB.Net?
I've searched the forums, all of the examples I found are using VB6...
I would like to use something like the processor or motherboard, but I would settle for the hard drive's serial number.
Thanks for your posts,
Squirrelly1
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
-
Apr 17th, 2004, 12:22 AM
#2
Sleep mode
-
Apr 17th, 2004, 07:39 AM
#3
Junior Member
WMI (Windows Management Instrumentation) Objects are your friend 
you'd be surprised what you can do with WMI and Performance Counter Objects as well
You can eliminate tons of API code from your programs
www.mod2software.com
Home of the VB.NET Class Builder Utility - Demo and Full versions available now!
-
Apr 18th, 2004, 07:10 PM
#4
Hyperactive Member
try this:
Code:
Imports Scripting
Public Function GetLicenceHDDSerialNumber() As String
Dim fso As New FileSystemObject()
GetLicenceHDDSerialNumber = fso.GetDrive("C").SerialNumber.ToString
End Function
"The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.
Windows & Web Developer
Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
Sutherland Shire, Sydney Australia
www.stingrae.com.au
Developer of Arnold - Gym & Martial Arts Database Management System
www.gymdatabase.com.au
-
Apr 19th, 2004, 03:05 AM
#5
Hyperactive Member
I tried, for my curiosity, but it doesn't obtain my HD serial number, but a negative number that probably is the volume number. I had the same result using a procedure that specifically obtain the volume number. With your procedure, as well as using the other one, I can obtain also another number, from the partition E: of the same HD, but serial HD number is unique on the same Disc.
Live long and prosper (Mr. Spock)
-
Nov 26th, 2008, 01:38 AM
#6
Hyperactive Member
Re: Get HDD Serial with .Net
Yes. This gives only the serial no of the relevent partition. I also want to know how to get the HDD serial no.
Thanx
If the post is heplful, Please Rate it
Chathura Wijekoon
-
Nov 26th, 2008, 02:05 AM
#7
Re: Get HDD Serial with .Net
 Originally Posted by Chathura
Yes. This gives only the serial no of the relevent partition. I also want to know how to get the HDD serial no.
Thanx
WMI is indeed the way to go. Take a look at the Win32_DiskDrive class. I did this myself a while back and I seem to recall that I had to use the Win32_PhysicalMedia and Win32_DiskDrivePhysicalMedia classes too. Just be aware that if a system is running a RAID array then you will not be able to get the individual serial numbers as the entire array is seen as a hard drive. I never did find a way around that.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|