[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3036
  • Last Modified:

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.
0
detroitdr
Asked:
detroitdr
  • 5
  • 5
  • 4
  • +1
3 Solutions
 
KirrilianCommented:
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 CoachmanCommented:
detroitdr,

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

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

:<
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
Jeffrey CoachmanCommented:
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 CoachmanCommented:
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 CoachmanCommented:
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:
Simply from the Immediate Pane:

? CreateObject("Scripting.FileSystemObject").GetDrive("a:\").SerialNumber
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 CoachmanCommented:
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

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

  • 5
  • 5
  • 4
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now