Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Hard drive serial (manufacturer) number

  • 17-05-2007 2:00pm
    #1
    Registered Users, Registered Users 2 Posts: 1,821 ✭✭✭


    Just wondering if it is possible to retrieve hard drive manufacturer serial number... I used this example here:

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

    where it accesses the wmi. Problem is, it doesn't work all the time. I've noticed if a computer is running .net framework 2.0 (i used 1.1) then it doesn't work. I don't have the ability to test it on 3.0

    the problem is when trying to access the SerialNumber variable in the Win32_PhysicalMedia API.
     // get the hardware serial no.
        if (wmi_HD["SerialNumber"] == null)
         hd.SerialNo = "None";
        else
         hd.SerialNo = wmi_HD["SerialNumber"].ToString();
        
        ++i;
    

    Can anybody point me in the right direction? It just displays None, when I try run it on .net 2.0


Comments

  • Closed Accounts Posts: 1,567 ✭✭✭Martyr


    you could try this VBScript here, see what results you get.

    [PHP] strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")
    Set colSettings = objWMIService.ExecQuery _
    ("Select * from Win32_PhysicalMedia")
    For Each objPhysicalMedia in colSettings
    Wscript.Echo "Serial Number: " & _
    objPhysicalMedia.SerialNumber
    Next[/PHP]

    might be your operating system doesn't support it? i know highly unlikely..but just incase.
    could be just doesn't have one!


  • Registered Users, Registered Users 2 Posts: 1,821 ✭✭✭Skud


    that didn't work. I have an idea what might be going wrong with it though... Comes with a default hard drive password. Maybe that's why windows wasn't picking it up, being built with that.

    BTW for future information, Windows Genuine Advantage records the serial of the hard drive. If that doesn't, then it's not recognised in windows :p


Advertisement