|
-
Mar 7th, 2003, 02:47 PM
#1
Thread Starter
Frenzied Member
Old story of HDD Serial, New Issues..[Long Live WMI]
In a thread there was a discussion about how to get the HDD serial number. There, an API was suggested that returned the VOLUME serial number. Today I came across FileSystemObject, that by using that you can simply get the VOLUME serial number:
After adding a reference to Microsoft Scripting Runtime COM component you can easily do that by:
VB Code:
Imports Scripting
'
'
Dim fso As New FileSystemObject()
MessageBox.Show(fso.GetDrive("C").SerialNumber.ToString)
As you see this method and that API call both return the Volume Serial number.
I like to know is there a way to read the hard-coded manufacturer's hard drive serial number? Just curious to know
Last edited by Lunatic3; Apr 1st, 2003 at 01:56 PM.
-
Mar 7th, 2003, 03:26 PM
#2
I dont beleive thats anywhere "in" the HD. I think the only place that exsists is on a sticker on the HD.
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Apr 1st, 2003, 01:55 PM
#3
Thread Starter
Frenzied Member
No [LGS]Static! Its not only on the sticker.
I finally found a method to do that. Ofcourse this seems to work only under XP.
VB Code:
' Code to read the hard coded manufactutrer Serial Number of Hard Disk
Dim mgmclass As New System.Management.ManagementClass("Win32_PhysicalMedia")
Dim mgmcoll As Management.ManagementObjectCollection = mgmclass.GetInstances()
Dim mgmenum As Management.ManagementObjectCollection.ManagementObjectEnumerator = mgmcoll.GetEnumerator
mgmenum.MoveNext()
MessageBox.Show(mgmenum.Current.Properties("SerialNumber").Value.ToString)
In this manner you should be able to read other physical media such as CD-ROM, Floppy,... but there are some strange things I dont understand about it. Still working on that.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Apr 1st, 2003, 02:58 PM
#4
Sleep mode
Cool . I can get HD Serial # with only two lines .
Good job Lunatic3
-
Apr 1st, 2003, 08:25 PM
#5
Addicted Member
I have a question is the volume drive serial no and the hd serial number two diffrent thing alltogether?
-
Apr 2nd, 2003, 02:23 AM
#6
Thread Starter
Frenzied Member
Yes, I think they are!
HD serial number is a serial number hard coded by manufacturer and is also written on the sticker of your Hard Disk. But Volume Serial Number is given to each partition when its formatted. It will change when you reformat the partition and also can be changed without formating the partition by editing the boot sector of partion. Also when you have spanned some partitions to one Volume then they will have only one Volume Serial Number.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
May 1st, 2003, 09:32 PM
#7
Hyperactive Member
sorry,
i think i'm missing something really obvious. i cannot seem to get this line to work:
I've put it with the other Imports line but this one cannot be found. is there a "trick" to this one?
cheers,
"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
-
May 1st, 2003, 09:37 PM
#8
Hyperactive Member
d'oh!
ignore that previous post!
Code:
To create a reference to the Scripting type library (Scrrun.dll)
On the Project menu, click Add Reference, and then click the COM tab.
Choose Microsoft Scripting Runtime from the Component Name list, and then click Select.
You can now use the Object Browser to view the FSO model's objects, collections, properties, methods, events, and constants.
"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
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
|