Click to See Complete Forum and Search --> : Code : Hard Disk Serial Number (firmware #)
yogiyang
Mar 9th, 2007, 05:23 AM
Get your PCs hard disk drive firm ware number (the number that does not change and that is added by the HDD manufacturer during manufacturing of HDD).
Check it out!
Eftim Stoyanov
Apr 8th, 2007, 12:56 PM
Dear Sir,
I have downloaded your program. It seems great! Will you be so kind to send me some explanation how to install and use the programs. Loading the programs into VB 6.0 (may be rong), in the combibox there is no results! Thank you in advance!
Eftim Stoyanov
stuckonsomething
Apr 20th, 2007, 08:14 AM
Thank you YogiYang you deserve a medal for sharing this
Yogi Yang
May 2nd, 2007, 09:35 AM
Dear Sir,
I have downloaded your program. It seems great! Will you be so kind to send me some explanation how to install and use the programs. Loading the programs into VB 6.0 (may be rong), in the combibox there is no results! Thank you in advance!
Eftim Stoyanov
Please read the document in the zip file and use your head a bit. :)
Ellis Dee
May 2nd, 2007, 10:09 AM
Fantastic contribution.
I'd like to incorporate this into my library (http://www.vbforums.com/showthread.php?t=466340). Do you have any objection?
If you'd like me to give credit to a name other than "yogiyang", PM me.
Yogi Yang
May 18th, 2007, 02:32 AM
Fantastic contribution.
I'd like to incorporate this into my library (http://www.vbforums.com/showthread.php?t=466340). Do you have any objection?
If you'd like me to give credit to a name other than "yogiyang", PM me.
No objections at all. I will be :) that my code is usefull to someone.
But I must say that I am not able to get this code to work properly in VISTA Final Release. It was working in the FirstBeta version but not in final release.
Good luck to you.
Yogi Yang
raouf505
May 19th, 2007, 12:12 AM
Thank you yogiyang
randem
Aug 29th, 2007, 04:34 AM
Handy piece of code...
nepalbinod
Sep 11th, 2007, 05:06 AM
I have already used your code in my project for security. It is really helpful, but please let us know if you have the same thing for SATA hard disks too.
Yogi Yang
Sep 12th, 2007, 10:15 AM
I have already used your code in my project for security. It is really helpful, but please let us know if you have the same thing for SATA hard disks too.
I own two SATA HDDs and it is working without any problem. There must be some other problem at you end.
If you are having problem using this library then please use WMI for extracting storage media information and then separate the HDDs firmware from it.
By the way this will not work with all types of SCSI HDDs as far as my experience goes :o
Hack
Sep 12th, 2007, 11:07 AM
No objections at all. I will be :) that my code is usefull to someone.
But I must say that I am not able to get this code to work properly in VISTA Final Release. It was working in the FirstBeta version but not in final release.
Good luck to you.
Yogi YangWhat problems is Vista giving you?
yogiyang
Sep 27th, 2007, 08:15 AM
What problems is Vista giving you?
My program is not throwing any errors. Just nothing seems to happen and no data is returned. I don't know what is wrong.
Currently I am busy on another project which involves a lot of programming as it is regarding Image Processing.
Will try to find a solution when free :cool:
riech
Nov 14th, 2007, 12:44 AM
nice code !!
Expecting code to co-operate with vista and SCSI hard disk
yogiyang
Nov 17th, 2007, 12:41 AM
nice code !!
Expecting code to co-operate with vista and SCSI hard disk
I will look into this but later as currently it is not in my priority list.
I am currently absorbed with Delphi as I am planning to switch to Delphi for all my mainstream software development.
Any way thanks for your interest.
riech
Nov 29th, 2007, 04:34 AM
expecting code for vista
[Email address removed; communication of these should be done by PM — Mod]
randem
Nov 29th, 2007, 03:58 PM
There is another approach using Wmi That does work on Vista. Search for it. I will post it if I find it.
riech
Nov 30th, 2007, 03:11 AM
Please send me the code
isn't that code work with SCSI drives ?
randem
Nov 30th, 2007, 04:22 AM
I forgot who originally posted it but here it is
Option Explicit
Public Function GetHDSerialNumber() As String()
Dim arrComputers() As String
Dim strComputer As Variant
Dim objWMIService As Object
Dim colItems As Object
Dim objItem As Object
Const wbemFlagReturnImmediately = &H10
Const wbemFlagForwardOnly = &H20
Dim arHD() As String
Dim i As Integer
On Error Resume Next
arrComputers = Array(".")
For Each strComputer In arrComputers
Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PhysicalMedia", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
Debug.Print "SerialNumber: " & objItem.SerialNumber
Debug.Print "Tag: " & objItem.Tag
Debug.Print
ReDim Preserve arHD(i)
arHD(i) = Trim(objItem.SerialNumber)
i = i + 1
Next
Next
GetHDSerialNumber = arHD
Set colItems = Nothing
Set objWMIService = Nothing
End Function
Yogi Yang
Dec 2nd, 2007, 01:42 AM
I forgot who originally posted it but here it is
Option Explicit
Public Function GetHDSerialNumber() As String()
Dim arrComputers() As String
Dim strComputer As Variant
Dim objWMIService As Object
Dim colItems As Object
Dim objItem As Object
Const wbemFlagReturnImmediately = &H10
Const wbemFlagForwardOnly = &H20
Dim arHD() As String
Dim i As Integer
On Error Resume Next
arrComputers = Array(".")
For Each strComputer In arrComputers
Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PhysicalMedia", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
Debug.Print "SerialNumber: " & objItem.SerialNumber
Debug.Print "Tag: " & objItem.Tag
Debug.Print
ReDim Preserve arHD(i)
arHD(i) = Trim(objItem.SerialNumber)
i = i + 1
Next
Next
GetHDSerialNumber = arHD
Set colItems = Nothing
Set objWMIService = Nothing
End Function
Thanks for the code snippet. But the main problem is that the code that I have developed is for running on all Windows 32Bit versions and not only in Windows 2000 onwards.
The WMI part is easy but a user can easily disable or uninstall WMI from his or her system and this will break any software which is built around WMI.
I am not interested in that......
Now that you already have code for extracting HDD serial using WMI please update my code and repost it.
Thanks in advance.
riech
Dec 5th, 2007, 10:51 AM
Why it is deficult to get the out put in Vesta ?
yogiyang
Dec 7th, 2007, 03:39 AM
Why it is deficult to get the out put in Vesta ?
To tell the truth VISTA itself is very difficult for me to grasp and adopt. it is tooooo :cool: for me.
I am using Win XP on a p4, 1GHz processor having 128 MB RAM. Will VISTA run on this without a hitch? Of course not. Currently XP's log in screen comes up in just 20 seconds after booting my PC. What would happen in case of VISTA :confused:
I will eventually upgrade to VISTA when I upgrade my Hardware and when VISTA becomes more use able and less buggy :bigyello:
yogiyang
Dec 25th, 2007, 02:12 AM
I found a Class for reading HDD Firmware which is very easy to use... Check it out. It is not mine. It is developed by a Spanish
' Oggetto HDSN
' Esempio d'uso
Chek attachment.
riech
Mar 3rd, 2008, 03:18 AM
Any develop using Vista ?
yogiyang
Mar 4th, 2008, 12:11 AM
Any develop using Vista ?
To tell you the truth. Vista is not in my radar as currently I am switching to Delphi for all my software development. :(
You will have to try something by yourself as I will not be able to help you out. Sorry. :o
matthewetaft2008
Mar 7th, 2008, 11:15 PM
Hi Everyone,
This is the best piece of code I've found for this, and YES!!! IT WORKS WITH VISTA!!! I had the same "error" as mentioned above, with the fields just being blank. I played around for a while, and the "blank fields" are due to User Account Control in Vista. The CreateFile function that is called needs to have administrative permissions (see http://msdn2.microsoft.com/en-us/library/aa363858(VS.85).aspx).
If you're developing an app that you'll only run yourself, you can just right-click the application and choose "Run as Administrator." For real world software, you'll need a Vista UAC work around. I haven't done this in VB, but I've done it in NSIS Installer successfully, so there's a way to do it. I just haven't got there yet. In my installer, if I don't have adequate permissions, I prompt the user to type in an administrative password so that I can gain these permissions. I'm going to be looking for a more pretty way to handle this in software, so that my users don't see this message whenever they start the software.
yogiyang
Apr 3rd, 2008, 08:31 AM
Hi Everyone,
This is the best piece of code I've found for this, and YES!!! IT WORKS WITH VISTA!!! I had the same "error" as mentioned above, with the fields just being blank. I played around for a while, and the "blank fields" are due to User Account Control in Vista. The CreateFile function that is called needs to have administrative permissions (see http://msdn2.microsoft.com/en-us/library/aa363858(VS.85).aspx).
If you're developing an app that you'll only run yourself, you can just right-click the application and choose "Run as Administrator." For real world software, you'll need a Vista UAC work around. I haven't done this in VB, but I've done it in NSIS Installer successfully, so there's a way to do it. I just haven't got there yet. In my installer, if I don't have adequate permissions, I prompt the user to type in an administrative password so that I can gain these permissions. I'm going to be looking for a more pretty way to handle this in software, so that my users don't see this message whenever they start the software.
Thank you for solving the problem. I thought I was the only one who was responsible for solving the problem (and not having Vista I could not) as no one was extending a helping hand in this regards.
If you do find a work around for prompting for Administrative Password please do share it with us here on this forum.
Thanks again.
Regards,
Yogi Yang
dicktracy007
Jun 26th, 2008, 12:45 AM
Hi Yogi,
Great Post. I too wish to include this in my app but do not know how. And there is no Notepad or instruction file in the downloaded zip file. Pray help..
yogiyang
Jun 27th, 2008, 04:52 AM
Hi Yogi,
Great Post. I too wish to include this in my app but do not know how. And there is no Notepad or instruction file in the downloaded zip file. Pray help..
It is simple. Just take the necessary code files and add them to your existing project. Now call the necessary functions to retrive HDD's serial number. That is it.
Still more easier is to use the class "HDSN.cls" that I have uploaded later. It is a class which has to be instantiated. Now call necessary methods to get the serial number.
I don't know how else should I help you on this.
Regards,
Yogi Yang
Deliriumxx
Jul 1st, 2009, 09:54 PM
Does this last class work with Vista and Windows 7
mustiback
Sep 8th, 2009, 03:34 PM
Thank You (:
yogiyang
Sep 11th, 2009, 10:12 AM
Thank You (:
You are welcome
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.