473,386 Members | 1,736 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,386 software developers and data experts.

Drive Volume Serial Number

Does anyone know how to access the Volume Serial Number of a drive
using .NET? It is easily done in VB6 using the FilingSystemObject. I
appreciate any insight into the matter.
Jul 21 '05 #1
3 4088
Use the WMI managed objects in .Net. Here is a sample to get the volume
serial number for the 'C' drive:

System.Management.ObjectQuery q = new ObjectQuery("select * from
Win32_LogicalDisk where name = 'c:'");
ManagementObjectSearcher s = new ManagementObjectSearcher(q);
foreach (ManagementObject share in s.Get())
{
Console.WriteLine(share["VolumeSerialNumber"]);
}

Sujit D'Mello
"mi**@softwarecompany.com" wrote:
Does anyone know how to access the Volume Serial Number of a drive
using .NET? It is easily done in VB6 using the FilingSystemObject. I
appreciate any insight into the matter.

Jul 21 '05 #2
Thanks for the quick response. I'm fairly new to this. Do you have a
more specific VB.NET sample?

On Thu, 23 Sep 2004 17:53:03 -0700, "Sujit D'Mello"
<Su*********@discussions.microsoft.com> wrote:
Use the WMI managed objects in .Net. Here is a sample to get the volume
serial number for the 'C' drive:

System.Management.ObjectQuery q = new ObjectQuery("select * from
Win32_LogicalDisk where name = 'c:'");
ManagementObjectSearcher s = new ManagementObjectSearcher(q);
foreach (ManagementObject share in s.Get())
{
Console.WriteLine(share["VolumeSerialNumber"]);
}

Sujit D'Mello
"mi**@softwarecompany.com" wrote:
Does anyone know how to access the Volume Serial Number of a drive
using .NET? It is easily done in VB6 using the FilingSystemObject. I
appreciate any insight into the matter.


Jul 21 '05 #3
mi**@softwarecompany.com wrote:
Does anyone know how to access the Volume Serial Number of a drive
using .NET? It is easily done in VB6 using the FilingSystemObject. I
appreciate any insight into the matter.

Try this:

http://www.vb-helper.com/howto_net_get_drive_info.html

Stanley
Jul 21 '05 #4

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

Similar topics

5
by: | last post by:
Hi, Do memory sticks have serial numbers like harddrives? If so how can I get this, I want to uniquely identify a memory stick (removable drive) for authentication. Thanks
2
by: Dan | last post by:
Does anyone know how to determine the physical hard drive serial number? I found a GetVolumeInformation function in C++ but wanted a comparable function in VB.net or C#. Thanks Dan Shanyfelt
5
by: Tayyab | last post by:
Hi, If you understand the subject of my post that means you would know why i want this. Please dont give me the code for Volume number as i am talking about manufacturer serial number. I am working...
7
by: ML | last post by:
What is the best/easiest means to return the serial/volume number of the drive containing the OS using VB.NET? I'm looking to get this information as a unique ID for activation/registration of a...
3
by: Arne Beruldsen | last post by:
How do you read the serial number to a hard drive? Thanks...Arne
2
by: mikeybe | last post by:
Anyone know how to return the disk number (i.e. the number you see when you launch windows disk manager and see your drives numbered disk 0, disk 1, etc.)? I'm not talking about the volume serial...
3
by: misc | last post by:
Does anyone know how to access the Volume Serial Number of a drive using .NET? It is easily done in VB6 using the FilingSystemObject. I appreciate any insight into the matter.
18
by: cjl | last post by:
Hey: I am trying to run python from a usb drive under windows xp. I installed python "for this user" on to a machine, then copied the entire Python24 directory to the usb drive. I have the...
4
by: Benjamins via AccessMonster.com | last post by:
Hi, I have used CreateObject("Scripting.FileSystemObject") to get the disk volume. Is there any other way of get the disk volume other than using the FSO. Thanks -- Message posted via...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.