473,382 Members | 1,437 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Reading Hard Drive Number

How do you read the serial number to a hard drive?

Thanks...Arne
Nov 21 '05 #1
3 2147
Hi Arne!

"Arne Beruldsen" schrieb
How do you read the serial number to a hard drive?


use WMI:

' Add a reference to System.Management.dll

Dim myDisk As New ManagementObject( _
"Win32_LogicalDisk.DeviceID=""C:""")

Dim myDiskProp As PropertyData = _
myDisk.Properties("VolumeSerialNumber")

Debug.WriteLine(myDiskProp.Value.ToString())

Cheers

Arne Janning
Nov 21 '05 #2
Add a reference to "System.Management.dll" and import the
'System.Management' namespace:

\\\
Dim disk As New ManagementObject( _
"Win32_LogicalDisk.DeviceID=""C:""" _
)
Dim diskPropertyA As PropertyData = _
disk.Properties("VolumeSerialNumber")
MsgBox(diskPropertyA.Value.ToString())
///

Just For Fun....(Yes I need a life!!)
Control Panel (CONTROL.EXE)
--------------------------------
Control Panel:
rundll32.exe shell32.dll,Control_RunDLL

Accessability Options (ACCESS.CPL)
---------------------------------------
Accessability Properties (Keyboard):
rundll32.exe shell32.dll,Control_RunDLL access.cpl,,1
Accessability Properties (Sound):
rundll32.exe shell32.dll,Control_RunDLL access.cpl,,2
Accessability Properties (Display):
rundll32.exe shell32.dll,Control_RunDLL access.cpl,,3
Accessability Properties (Mouse):
rundll32.exe shell32.dll,Control_RunDLL access.cpl,,4
Accessability Properties (General):
rundll32.exe shell32.dll,Control_RunDLL access.cpl,,5

Add/Remove Programs (APPWIZ.CPL)
-------------------------------------
Add/Remove Programs Properties (Install/Uninstall):
rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl,,1
Add/Remove Programs Properties (Windows Setup):
rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl,,2
Add/Remove Programs Properties (Startup Disk):
rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl,,3

Display Options (DESK.CPL)
-------------------------------
Display Properties (Background):
rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,0
Display Properties (Screen Saver):
rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,1
Display Properties (Appearance):
rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,2
Display Properties (Settings):
rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,3

Regional Settings (INTL.CPL)
---------------------------------
Regional Settings Properties (Regional Settings):
rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,0
Regional Settings Properties (Number):
rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,1
Regional Settings Properties (Currency):
rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,2
Regional Settings Properties (Time):
rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,3
Regional Settings Properties (Date):
rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,4

Joystick Options (JOY.CPL)
-------------------------------
Joystick Properties (Joystick):
rundll32.exe shell32.dll,Control_RunDLL joy.cpl

Mouse/Keyboard/Printers/Fonts Options (MAIN.CPL)
-----------------------------------------------------
Mouse Properties:
rundll32.exe shell32.dll,Control_RunDLL main.cpl @0
Keyboard Properties:
rundll32.exe shell32.dll,Control_RunDLL main.cpl @1
Printers:
rundll32.exe shell32.dll,Control_RunDLL main.cpl @2
Fonts:
rundll32.exe shell32.dll,Control_RunDLL main.cpl @3

Mail and Fax Options (MLCFG32.CPL)
---------------------------------------
Microsoft Exchange Profiles (General):
rundll32.exe shell32.dll,Control_RunDLL mlcfg32.cpl

Multimedia/Sounds Options (MMSYS.CPL)
------------------------------------------
Multimedia Properties (Audio):
rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,0
Multimedia Properties (Video):
rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,1
Multimedia Properties (MIDI):
rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,2
Multimedia Properties (CD Music):
rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,3
Multimedia Properties (Advanced):
rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,4
= = = = = = = = = = = = = = = = = = = = = = = = = = =
Sounds Properties:
rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl @1

Modem Options (MODEM.CPL)
------------------------------
Modem Properties (General):
rundll32.exe shell32.dll,Control_RunDLL modem.cpl

Network Options (NETCPL.CPL)
---------------------------------
Network (Configuration):
rundll32.exe shell32.dll,Control_RunDLL netcpl.cpl

Password Options (PASSWORD.CPL)
------------------------------------
Password Properties (Change Passwords):
rundll32.exe shell32.dll,Control_RunDLL password.cpl

System/Add New Hardware Options (SYSDM.CPL)
------------------------------------------------
System Properties (General):
rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,0
System Properties (Device Manager):
rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,1
System Properties (Hardware Profiles):
rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,2
System Properties (Performance):
rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,3
= = = = = = = = = = = = = = = = = = = = = = = = = = =
Add New Hardware Wizard:
rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl @1

Date and Time Options (TIMEDATE.CPL)
-----------------------------------------
Date/Time Properties:
rundll32.exe shell32.dll,Control_RunDLL timedate.cpl

Microsoft Mail Postoffice Options (WGPOCPL.CPL)
----------------------------------------------------
Microsoft Workgroup Postoffice Admin:
rundll32.exe shell32.dll,Control_RunDLL wgpocpl.cpl
================================================== ==
SYSTEM WIZARDS
================================================== ==
Open With (File Associations):
rundll32.exe shell32.dll,OpenAs_RunDLL d:\path\filename.ext

Run Diskcopy Dialog:
rundll32 diskcopy.dll,DiskCopyRunDll

Create New Shortcut Wizard:
'puts the new shortcut in the location specified by %1
rundll32.exe AppWiz.Cpl,NewLinkHere %1

Install New Hardware Wizard:
rundll32.exe sysdm.cpl,InstallDevice_RunDLL

Add Printer Wizard:
rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL AddPrinter

Dial-up Networking Wizard
rundll32.exe rnaui.dll,RnaWizard

Open a Scrap Document:
rundll32.exe shscrap.dll,OpenScrap_RunDLL /r /x %1

Create a Briefcase:
rundll32.exe syncui.dll,Briefcase_Create

View Printers:
rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder

View Fonts:
rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL FontsFolder

Pick a Time Zone Dialog:
rundll32.exe shell32.dll,Control_RunDLL timedate.cpl,,/f

"Arne Beruldsen" <Ar***********@discussions.microsoft.com> wrote in
message news:DD**********************************@microsof t.com:
How do you read the serial number to a hard drive?

Thanks...Arne


Nov 21 '05 #3
"Arne Janning" <sp*****************@msn.com> schrieb:
How do you read the serial number to a hard drive?


use WMI:

' Add a reference to System.Management.dll

Dim myDisk As New ManagementObject( _
"Win32_LogicalDisk.DeviceID=""C:""")

Dim myDiskProp As PropertyData = _
myDisk.Properties("VolumeSerialNumber")


Just a small note for the OP: Notice that the volume serial number can be
changed...

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: 3A Web Hosting | last post by:
Hi Folks This is probably starring me in the face but how do I read the contents of a hard drive directory? I've been playing around with the opendir($dir) sample from php.net and can read from...
18
by: shakeel-ur-rehman | last post by:
I am wrtiting programm in C++ to read/take complete image of the partiton. can any one let me know the internet resources and web sites having tutorials relating to this and tell any sequence ...
36
by: Ron Johnson | last post by:
http://hardware.devchannel.org/hardwarechannel/03/10/20/1953249.shtml?tid=20&tid=38&tid=49 -- ----------------------------------------------------------------- Ron Johnson, Jr....
18
by: Joe Lester | last post by:
This thread was renamed. It used to be: "shared_buffers Question". The old thread kind of died out. I'm hoping to get some more direction by rephrasing the problem, along with some extra...
14
by: Lauren Wilson | last post by:
Discovered this interesting comment on MSDN: "To programmatically obtain the hard disk's serial number that the manufacturer assigns, use the Windows Management Instrumentation (WMI)...
4
by: Zeeshan | last post by:
hi, i want to get the hard drive number for example if if have drive letter C it should tell me Disk number as 1 and suppose if i have another hard disk attach to my system having letter J, the by...
7
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
16
by: WATYF | last post by:
Hi there... I have a huge text file that needs to be processed. At the moment, I'm loading it into memory in small chunks (x amount of lines) and processing it that way. I'd like the process to be...
23
by: Rotsey | last post by:
Hi, I am writing an app that scans hard drives and logs info about every fine on the drive. The first iteration of my code used a class and a generic list to store the data and rhis took...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.