473,324 Members | 2,581 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,324 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 4086
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.