Can anyone please help me to get Serial Number of my hard drive?

M

Mota

Hi;
I want to get serial no. of a system H.D.D .I used this WMI script on win xp
but it doesnt work.AFAIR wmi is installed on Win XP by default but dont know
what i have to replace in this code ,or what other is wrong:

' Code from MSDN library
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colSMBIOS = objWMIService.ExecQuery _
("Select * from Win32_SystemEnclosure")
For Each objSMBIOS in colSMBIOS
Wscript.Echo "Part Number: " & objSMBIOS.PartNumber
Wscript.Echo "Serial Number: " _
& objSMBIOS.SerialNumber
Wscript.Echo "Asset Tag: " _
& objSMBIOS.SMBIOSAssetTag
Next

Can u help me?
Thank you in advance.
 
M

Mota

AFAIK,drive IDs returned by this API are given by OS when formatting
partition.so its subject to change.
Can you please help me to get Hard Drive Serial Number (given by making
company).I think i need to apply WindowsManagementInstrument.
Thank you for your help.
 
R

Ron Weiner

M

Mota

Thanx a lot for searching instead of me.

Ron Weiner said:
You might want to do a little Google-ing on your own but I found these
links
in less than 2 minutes by searching for "Hardware Hard Drive serial number
VB"

http://www.hardwareforumz.com/-Serial-Number-Visual-Basic-ftopict42.html

http://www.experts-exchange.com/Programming/Q_20698469.html


Here is another that you may be able to translate from C#

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

There are undoubtly other sites with similar code samples.

Ron W
www.WorksRite.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top