Discovered this interesting comment on MSDN:
"To programmaticall y obtain the hard disk's serial number that the
manufacturer assigns, use the Windows Management Instrumentation (WMI)
Win32_PhysicalM edia (a class) property SerialNumber."
I'm sorry to admit it bit I am really undereducated on how to
incorporate some of the Windows SDK stuff into VBA apps. Anyone know
of some sample code that will allow us to read the C drive hardware
serial number? I'm NOT talking about the serial number assigned to a
drive by the OS, I'm talking about the serial number given by the HD
manufacturer and encoded on the drive's ROM chip.
The WHY of this question is too complicated to go into right now.
Any help or advice will be much appreciated.
Thanks folks,
-- LW
Mar 7 '06
14 28185
Never mind. It appears that Drive 0 is always listed first.
On Mon, 13 Mar 2006 13:34:03 -0600, Lauren Wilson <no****@nospam. com>
wrote: Hi David! Thanks for your response.
This works perfectly. However, it naturally returns SNs for ALL of the HDs on my system. I need a way to return JUST the primary drive SN (Drive 0). I tried inserting Debug.Print "SN: " & obj.name & ": " & obj.SerialNumbe r, but the Name property returned only empty strings. Is there a way to limit the output to only the SN for Drive 0?
Thanks again.
-- LW.
On Mon, 13 Mar 2006 16:38:48 +1100, "david epsom dot com dot au" <david@epsomdo tcomdotau> wrote:
In MSDOS it was easy to retrieve standard HD information, but in Windows, hardware is virtualised, and you can't get at it.
Windows does now provide a path to an interface for HD serial numbers, but it is the SMART drive interface and I don't know what you will get if SMART is turned off, or if you have SCSI disks, or if you have Serial ATA disks, etc.
http://vbnet.mvps.org/index.html?code/disk/smartide.htm
manufacturer assigns, use the WMI Win32_PhysicalM edia property SerialNumber."
I've never seen that work, but go ahead and try it:
'---------- Sub GetPhysicalSeri al()
Dim obj As Object Dim WMI As Object
Set WMI = GetObject("WinM gmts:")
For Each obj In WMI.InstancesOf ("Win32_Physica lMedia") Debug.Print "SN: " & obj.SerialNumbe r Next
End Sub '-----------
(david)
"Lauren Wilson" <no****@nospam. com> wrote in message news:rm****** *************** ***********@4ax .com... Discovered this interesting comment on MSDN:
"To programmaticall y obtain the hard disk's serial number that the manufacturer assigns, use the Windows Management Instrumentation (WMI) Win32_PhysicalM edia (a class) property SerialNumber."
I'm sorry to admit it bit I am really undereducated on how to incorporate some of the Windows SDK stuff into VBA apps. Anyone know of some sample code that will allow us to read the C drive hardware serial number? I'm NOT talking about the serial number assigned to a drive by the OS, I'm talking about the serial number given by the HD manufacturer and encoded on the drive's ROM chip.
The WHY of this question is too complicated to go into right now.
Any help or advice will be much appreciated.
Thanks folks,
-- LW
Thanks a lot PP! The last article was VERY helpful.
We have now tested my WMI code on several Windows PCs, all XP or 2000
machines. In every case, the drive ID's returned exactly matched the
drive serial number originally provided by the drive mfg! I don't
know if this will work on EVERY PC. So far, it looks good.
The bottom line for ALL of this is that there is a growing need to
identify a particular PC with absolute certainty. This approach may
not be the final method, but it seems to move in that direction.
On Tue, 14 Mar 2006 06:36:00 GMT, polite person <si*****@ease.c om>
wrote: On Mon, 13 Mar 2006 13:34:03 -0600, Lauren Wilson <no****@nospam. com> wrote:
Hi David! Thanks for your response.
This works perfectly. <snip>
Hi I'm sure all the WMI methods will give the same result but in answer to your worry about whether the result is really the serial number or whether it is just what the OS thinks it is .. see
http://msdn.microsoft.com/library/de...ce_drivers.asp Accessing Device Drivers
http://msdn.microsoft.com/library/de...m_provider.asp WDM Provider
or http://www.expresscomputeronline.com...chspace1.shtml for an outside overview of how WMI works.
Draw your own conclusions! Maybe you should read the refs in reverse order.
> The bottom line for ALL of this is that there is a growing need identify a particular PC with absolute certainty. This approach
It doesn't identify my PC :~) I get a blank for the serial
number using that method.
(david)
"Lauren Wilson" <no****@nospam. com> wrote in message
news:k4******** *************** *********@4ax.c om... Thanks a lot PP! The last article was VERY helpful.
We have now tested my WMI code on several Windows PCs, all XP or 2000 machines. In every case, the drive ID's returned exactly matched the drive serial number originally provided by the drive mfg! I don't know if this will work on EVERY PC. So far, it looks good.
The bottom line for ALL of this is that there is a growing need to identify a particular PC with absolute certainty. This approach may not be the final method, but it seems to move in that direction.
On Tue, 14 Mar 2006 06:36:00 GMT, polite person <si*****@ease.c om> wrote:
On Mon, 13 Mar 2006 13:34:03 -0600, Lauren Wilson <no****@nospam. com> wrote:
Hi David! Thanks for your response.
This works perfectly. <snip>
Hi I'm sure all the WMI methods will give the same result but in answer to your worry about whether the result is really the serial number or whether it is just what the OS thinks it is .. see
http://msdn.microsoft.com/library/de...ce_drivers.asp Accessing Device Drivers
http://msdn.microsoft.com/library/de...m_provider.asp WDM Provider
or http://www.expresscomputeronline.com...chspace1.shtml for an outside overview of how WMI works.
Draw your own conclusions! Maybe you should read the refs in reverse order.
On Wed, 15 Mar 2006 09:53:34 +1100, "david epsom dot com dot au"
<david@epsomdot comdotau> wrote: The bottom line for ALL of this is that there is a growing need identify a particular PC with absolute certainty. This approach It doesn't identify my PC :~) I get a blank for the serial number using that method.
Interesting. Mind saying what is your OS, and primary HD brand name?
(david)
"Lauren Wilson" <no****@nospam. com> wrote in message news:k4******* *************** **********@4ax. com... Thanks a lot PP! The last article was VERY helpful.
We have now tested my WMI code on several Windows PCs, all XP or 2000 machines. In every case, the drive ID's returned exactly matched the drive serial number originally provided by the drive mfg! I don't know if this will work on EVERY PC. So far, it looks good.
The bottom line for ALL of this is that there is a growing need to identify a particular PC with absolute certainty. This approach may not be the final method, but it seems to move in that direction.
On Tue, 14 Mar 2006 06:36:00 GMT, polite person <si*****@ease.c om> wrote:
On Mon, 13 Mar 2006 13:34:03 -0600, Lauren Wilson <no****@nospam. com> wrote:
Hi David! Thanks for your response.
This works perfectly. <snip>
Hi I'm sure all the WMI methods will give the same result but in answer to your worry about whether the result is really the serial number or whether it is just what the OS thinks it is .. see
http://msdn.microsoft.com/library/de...ce_drivers.asp Accessing Device Drivers
http://msdn.microsoft.com/library/de...m_provider.asp WDM Provider
or http://www.expresscomputeronline.com...chspace1.shtml for an outside overview of how WMI works.
Draw your own conclusions! Maybe you should read the refs in reverse order. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Gavin |
last post by:
Hi, I'm a newbie to programming of any kind. I have posted this to other
groups in a hope to get a response from anyone.
Can any one tell me how to make my VB program read the Bios serial number
(or would HDD be better, or both?) and put that info into VB prog so the
program won't work on another computer. My program uses an MSAccess table.
Much appreciated if you can help!
Thanks
|
by: tom |
last post by:
Hi,
How do I get the serial number of the harddisk in .NET?
I want this to be the same number even if the user has
reformatted, so I do not want the volume serial number.
Thanx,
t
|
by: Job Lot |
last post by:
How can I retrieve the Motherboard, hard drive, NIC Serial Number Using vb.net.
thanx
|
by: Nebojsa4 |
last post by:
Hi.
First, sorry on my weak English to all.
Qusetion:
How to read (in VB) Manufacturer serial number of Hard disk drive?
Not volume/serial number of C:, D:, etc. partitons.
For reading volume/serial number of hard disk C: etc, You can use Microsoft Scripting Runtime (in VB):
|
by: Paul Bromley |
last post by:
Ok - I have given up on trying to find the active IP address for a given PC.
For licensing purposes I need to retrive a unique identifier from the PC
that the program is installed on. The Hard disk serial number would do fine,
but on Googling it seems that some of the sample code will now laways work
on W2K, and not without administrator rights.
Hence my question - how can I consistently get a UNIQUE PC identifier using
vb.net 2003 - not...
| |
by: Adele le Roux |
last post by:
Hi All,
How can I get the hard disk serial number of a remote computer's C:? The
drive will NOT be mapped as a network drive.
Thanks,
Adele
|
by: preethaAjayan |
last post by:
Could anybody please help me with a piece of code to get hard disk's serial number using C#, not volume serial number, actual number that manufactures give to hard disks.
|
by: Matthew Connor |
last post by:
Hi all! I'm sure many of you rolled your eyes at the subject trying to
recall how many times youv'e heard this question. :) But bear with
because I THINK my question is at least slightly different from the
typical post.
I would like to obtain the manufactuer's embedded serial number (NOT
the volume serial that changes with each format) of USB drives. I
found some very handy code to obtain a regular SMART-enabled IDE
drive's information...
|
by: Airslash |
last post by:
Hello,
I've written a class that resembles a hard drive. I'm already able using the Windows API to get information such as the remaining free bytes, the sectors and clusters,a nd it all works fine.
The last step that I need is to obtain the serial number of the harddrive in question. From what I can understand in the MSDN library you need to take into account that a Volume can span multiple disks etc, but I don't wanne waste time on that...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |