How to get serial number of main Hard drive in VBA

Searching EE, I've found many VB examples of how to read the serial number of the c: drive. However these do not work for VBA.  can anyone convert it to work for VBA or have the code ready?

Thank-you in advance.
detroitdrAsked:
Who is Participating?
 
GRayLConnect With a Mentor Commented:
Simply from the Immediate Pane:

? CreateObject("Scripting.FileSystemObject").GetDrive("a:\").SerialNumber
0
 
KirrilianConnect With a Mentor Commented:
It looks like you can use WMI in VBA to get this information.

Check out this link:
http://www.codeproject.com/KB/vbscript/VvvHardwareInfo.aspx
0
 
Jeffrey CoachmanConnect With a Mentor MIS LiasonCommented:
detroitdr,

Also check out what SysInternals has to offer:
http://technet.microsoft.com/en-us/sysinternals/bb545046.aspx

JeffCoachman
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
detroitdrAuthor Commented:
Sysinternals doesn't do serial numbers of HD.
not does vvvhardwareInfo.

:<
0
 
Jeffrey CoachmanMIS LiasonCommented:
detroitdr,

The SN does not change, so why not just copy it from the drive itself?

In other words, why do you need VBA to tell you what the SN is, if it will always be the same?
What is this being used for?

JeffCoachman
0
 
detroitdrAuthor Commented:
boag2000

I need to read the serial number of the main hard drive (c:) and store it in a table in Access 2003. I do not know how to read the serial number from within Access2003 VBA. That is what I'm trying to get.

I'm not wanting to take the computer apart to visually look at the serial number, nor can I use any other programs to do it. I have to do it within VBA (Access 2003)

Any ideas?

(Yes the serial number does not change.)
0
 
Jeffrey CoachmanMIS LiasonCommented:
detroitdr,

 "(Yes the serial number does not change.)"

How does this happen? I did not know that a Hard drive's serial number could changed on demand?

JeffCoachman
0
 
detroitdrAuthor Commented:
"Yes the serial number does NOT change"

I'm agreeing with you. you can not change the serial number on a HD. All I want to do is read the serial number of a HD using VBA

Thx
0
 
Jeffrey CoachmanMIS LiasonCommented:
Oh, OK,

Sorry for the misunderstanding.
;-)

There may be a third party app out there that can do this.

Did you try a google search?

Jeff
0
 
GRayLCommented:
0
 
GRayLCommented:
Change "a:\" to "C:\" for drive c.
0
 
detroitdrAuthor Commented:
GRayl:

This is the VOL serial number of the HD, not the HD serial number itself. The Vol serial number changes every formatting. The HD serial number can not change. It's on the HD firmware itself.
0
 
Jeffrey CoachmanMIS LiasonCommented:
detroitdr,

"This is the VOL serial number of the HD, not the HD serial number itself. "
Well, ...You did not make this distinction clear in your original post.
;-)

JeffCoachman
0
 
GRayLCommented:
There is a piece of freeware at http://www.codeproject.com/KB/cs/hard_disk_serialno.aspx but you have to sign up.
0
 
detroitdrAuthor Commented:
Grayl, this is in C, not VBA.. I'll take it that it's very hard to do and not worth persueing. so I'll award equal points... really there still is not an answer to this. Thx all for your efforts!


0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.