Results 1 to 15 of 15

Thread: Reading HDD Serial number

  1. #1

    Thread Starter
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Reading HDD Serial number

    hi all!!

    how can i check the serial number of my HDD through VB??

    thnx
    Show Appreciation. Rate Posts.

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Reading HDD Serial number

    This is out of the code MartinLiss has in the codebank for a program registration scheme.


    VB Code:
    1. Private Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
    2.  
    3. Public Function GetSerialNumber() As Long
    4.     Dim strVolumeBuffer As String
    5.     Dim strSysName As String
    6.     Dim lngSerialNumber As Long
    7.     Dim lngSysFlags As Long
    8.     Dim lngComponentLen As Long
    9.     Dim lngResult As Long
    10.     strVolumeBuffer$ = String$(256, 0)
    11.     strSysName$ = String$(256, 0)
    12.     lngResult = GetVolumeInformation("C:\", strVolumeBuffer$, 255, lngSerialNumber, _
    13.             lngComponentLen, lngSysFlags, strSysName$, 255)
    14.     GetSerialNumber = lngSerialNumber
    15. End Function

  3. #3

    Thread Starter
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: Reading HDD Serial number

    thnx.............but it gives the HDD volume number.............i want to see the HDD serial number!!!
    Show Appreciation. Rate Posts.

  4. #4

    Thread Starter
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: Reading HDD Serial number

    worry not...............i read the other similar post n got it!! thnx DG

    abt Volume number, if someone can tell me how can i check it in Windows??
    Show Appreciation. Rate Posts.

  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Reading HDD Serial number

    I thought that's what you wanted.
    but it gives the HDD volume number...

  6. #6

    Thread Starter
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: Reading HDD Serial number

    Quote Originally Posted by dglienna
    I thought that's what you wanted.
    isn't serial number n volume number 2 different things??? if yes how can i check the volume number thru windows??

    actually, i thought these 2 are different things from the other similar post where u posted ur reply!!! i have absolutely no idea abt them.......these 2 numbers!!
    plz if u can explain!!!
    Show Appreciation. Rate Posts.

  7. #7
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Reading HDD Serial number

    There is the Hardware Serial Number, which is different for each hard disk, and cannot be changed. The Volume Serial Number is created each time the disk is formatted. Volume Serial Numbers conform to a standard, so they can be used in calculations.

  8. #8

    Thread Starter
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: Reading HDD Serial number

    thnx.......u helped me in checking it thru vb.......how can i check it thru windows???
    Show Appreciation. Rate Posts.

  9. #9
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Reading HDD Serial number

    Didnt you get this answered already? But anyways here is the link.

    http://vbnet.mvps.org/code/disk/smartide.htm
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  10. #10
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Reading HDD Serial number

    I don't think that you can, unless it's stored in the registry somewhere.

  11. #11

    Thread Starter
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: Reading HDD Serial number

    Quote Originally Posted by RobDog888
    Didnt you get this answered already? But anyways here is the link.

    http://vbnet.mvps.org/code/disk/smartide.htm
    oh thnx Rob............i saw that link already!!!!
    Show Appreciation. Rate Posts.

  12. #12
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Reading HDD Serial number

    You would have to check it in the BIOS before boot up manually. There are some HD manufacturers that provide a utility for reading the serial number but theyare probably written in C++
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  13. #13
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Reading HDD Serial number

    Did it not work for you then?

    It didnt work for me as I am running two sets of RAID Mirrors so all four of my hard drives dont show any results.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  14. #14

    Thread Starter
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: Reading HDD Serial number

    Quote Originally Posted by RobDog888
    You would have to check it in the BIOS before boot up manually. There are some HD manufacturers that provide a utility for reading the serial number but theyare probably written in C++
    i know that serial number is stored in BIOS.......i was asking abt how to check the volume number thru windows!!
    Show Appreciation. Rate Posts.

  15. #15
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Reading HDD Serial number

    Manually through windows or programatically? You have seen that link but havent stated if its working for you.

    Here is a screenie of my Intel RAID management utility. I had a drive die recently and havent replaced it yet or it would show both drives serial numbers. These are the serial numbers that are on the physical drive itself.
    Attached Images Attached Images  
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width