0

how to get harddrive serial number(not the volume # wich change at each reinstall of windows) in C or asm, without wmi (cause wmi required admin right). Any clue would be helpfull cause right now i found nothing on web in C without wmi, in dayss of searching... Thank you. EDIT : For windows system

5
  • 2
    I think it likely that the serial number is considered confidential information, so you cannot get it without administrator privilege. Commented Feb 26, 2013 at 2:54
  • You most probably won't be able to do this without privileged instructions. Commented Feb 26, 2013 at 6:47
  • @ Harry : serial# is not on cpu anymore for that reason, so that's why there is a variable for it now, but hard drive too...? Anyway even if mac add can be fake, it still a relaible way of id-ing computer, thus non confidential. Thank for uncertain info : at least its info. @Daniel : ok thanks too Commented Feb 26, 2013 at 6:50
  • In Windows you'd have to use DeviceIoControl and issue IDENTIFY commands using ATA passthrough to the drive. You would require admin-level access Commented Apr 9, 2013 at 0:41
  • cause wmi required admin right - Are you sure about that? Have you tried it? Doing wmic diskdrive get name, serialnumber from a non-admin account worked correctly for me. Programmatically what you're looking for is something like this, but opening up a physical disk like that almost certainly requires admin rights. Commented Sep 30, 2021 at 0:46

2 Answers 2

1

Please try my open source tool, DiskId32, which also has the source code at http://www.winsim.com/diskid32/diskid32.html . I only have an Win32 version at this time. Maybe some day I will add a Win64 version.

Sign up to request clarification or add additional context in comments.

1 Comment

Wow thanks : aaalmost solved my problem. But like you said on your website : "It runs under Windows 9X, Win NT, Win 2K and Win XP (Pro/Home)." and "has occasional problems on Windows XP, Windows 2003 Server and Vista" ... So it look hard to get those hd infos : bravo for your program! Porting it to w7 would be long/hard i guess? 55% of OS are W7 now, so...(for my self i'm in the XP resistance mouvement! ;p )
0

Hard drive serial number and other information about the harddrive like firmware version, etc. can only be obtained using SMART as far as I know and that requires special ioctls to the the block device node (/dev/sda or /dev/sdb) which is usually not available to a regular user.

I know there is a tool called smartctl which does exactly this:

sudo smartctl -i /dev/sda

Similar tools exist (hdparm, lshw, etc.) as well.

As far as trying to figure it out this info without being a privileged user, it might be possible only if it is exposed via /proc or /sys which I highly doubt is being done in the current SATA block device drivers.

2 Comments

Im in the window$ world (wmi) for now linux-dude but thanks anyway.
I'm not familiar with WMI, mentioning Windows explicity in the question would have made the point clearer :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.