Hard Disk Serial Number

hi.

i want 2 know that ,is there anyway to get hard disk serial number(Hard Disk , not Hard Drives) without using WMI.

plz forgive me for my bad english

go0d luCk



Answer this question

Hard Disk Serial Number

  • rsws

    Try this Code or visit this link

    http://www.vbcity.com/forums/topic.asp tid=103023

    Imports System.Management

    Dim tmpStr2 As String = ""

    Dim myScop As New Management.ManagementScope("\\" & Environment.MachineName & "\root\cimv2")

    Dim oQuer As New Management.SelectQuery("SELECT * FROM WIN32_DiskDrive")

    Dim oResult As New Management.ManagementObjectSearcher(myScop, oQuer)

    Dim oIte As Management.ManagementObject

    Dim oPropert As Management.PropertyData

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    For Each oIte In oResult.Get()

    For Each oPropert In oIte.Properties

    If Not oPropert.Value Is Nothing AndAlso oPropert.Name = "Signature" Then

    tmpStr2 = oPropert.Value.ToString

    Exit For

    End If

    Next

    Next

    MsgBox(tmpStr2)

    End Sub

    Greetings

    Simao

    landsimao.hotmail.com


  • oompa_l

    Hard disk and Hard drive is the same thing, just different term.

    To get the Volume label, take a look at the System.IO.DriveInfo class.

    You would get a list of drives on the system.

    for each drive, get the volumelabel of the drive.

     

    To get the serial number of a drive, I dont think this is possible in .NET unless you use WMI or perhaps call a Win32 function/PInvoke.

    try some of these resources, but they mainly refer to WMI

    http://www.microsoft.com/belux/msdn/nl/community/columns/sucaet/filesyst_en.mspx

    http://www.thecodeproject.com/csharp/hard_disk_serialno.asp

     

    You can use this to PInvoke:

    http://windowssdk.msdn.microsoft.com/en-us/library/ms685899.aspx

    Check this post on how to use it:

    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=357158&SiteID=1

     

    however it is best to use the .NET way of doing such things but .NET does not have a way of getting the serial number of the hard disk, unless you use WMI

     



  • KevinHall

    Special thnx to all of you for your helps

    tnx Simao for your help that was very useful .

    Go0d LuCk


  • tattoo

    Serial number is unique on each hard drive, its physically programmed on the circuit board/ROM.

    What you are referring to about different drives are logical partitions, which are volume numbers.

    Regardless how many logical partitions you have on a physical drive, the serial number is always the same, its built into the physical hard disk itself. The only change that will happen with the logical partitions is the volume label.



  • gparali

    thnx for your help.

    http://files.download-by.net/download/98643-hdd101.zip

    the link above is a program that get the HDD Serial Number without using WMI , it's only using API Functions to get SN of HDD.

    i want to get SN of HDD not Drives Like C: or D: .

    Go0d LuCk.


  • Hard Disk Serial Number