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

Serial number of Harddrive

Hi ALL,

how can I get serial number of harddrive using "pure" .NET, without Win API?

Thanx
Jul 21 '05 #1
3 1647
On Sat, 29 Nov 2003 03:02:29 +0100, "Evgeny Zoldin"
<ez*****@hotmail.com> wrote:
Hi ALL,

how can I get serial number of harddrive using "pure" .NET, without Win API?

Thanx

using System.Management;
//be sure to reference the System.Managment.dll

string GetSerialNumber(string drive)
{
ManagementObject disk=new
ManagementObject("win32_logicaldisk.deviceid=\"" + drive + ":\"");
return
disk.Properties["VolumeSerialNumber"].Value.ToString());
}
Jul 21 '05 #2
Also check out the other properties of some of the other WMI classes
(Win32_PhysicalMedia or Win32_DiskDrive), as you might find ID that isn't
related to the logical volume. Not all devices give an asset tag or Serial
number, but you can try. The volume serial is easily changed.
-mike
MVP

"Austin Ehlers" <th***********************@hotmail.com> wrote in message
news:fu********************************@4ax.com...
On Sat, 29 Nov 2003 03:02:29 +0100, "Evgeny Zoldin"
<ez*****@hotmail.com> wrote:
Hi ALL,

how can I get serial number of harddrive using "pure" .NET, without Win API?
Thanx

using System.Management;
//be sure to reference the System.Managment.dll

string GetSerialNumber(string drive)
{
ManagementObject disk=new
ManagementObject("win32_logicaldisk.deviceid=\"" + drive + ":\"");
return
disk.Properties["VolumeSerialNumber"].Value.ToString());
}

Jul 21 '05 #3
mp
You told as volume serial is easily changed. It is probably true and also
very interesting and would like to know how?

Thanks,
Mirko

"Michael Giagnocavo [MVP]" <mg*******@Atrevido.net> wrote in message
news:uZ**************@tk2msftngp13.phx.gbl...
Also check out the other properties of some of the other WMI classes
(Win32_PhysicalMedia or Win32_DiskDrive), as you might find ID that isn't
related to the logical volume. Not all devices give an asset tag or Serial number, but you can try. The volume serial is easily changed.
-mike
MVP

"Austin Ehlers" <th***********************@hotmail.com> wrote in message
news:fu********************************@4ax.com...
On Sat, 29 Nov 2003 03:02:29 +0100, "Evgeny Zoldin"
<ez*****@hotmail.com> wrote:
Hi ALL,

how can I get serial number of harddrive using "pure" .NET, without Win API?
Thanx

using System.Management;
//be sure to reference the System.Managment.dll

string GetSerialNumber(string drive)
{
ManagementObject disk=new
ManagementObject("win32_logicaldisk.deviceid=\"" + drive + ":\"");
return
disk.Properties["VolumeSerialNumber"].Value.ToString());
}


Jul 21 '05 #4

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

Similar topics

15
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
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
79
by: Klaus Bonadt | last post by:
In order to protect software from being copied without licence, I would like to use something like a key, which fits only to the current system. The serial number of the CPU or the current...
3
by: Stewart Allen | last post by:
Hi there I'm trying to find part serial numbers between 2 numbers. The user selects a part number from a combo box and then enters a range of serial numbers into 2 text boxes and the resulting...
3
by: Evgeny Zoldin | last post by:
Hi ALL, how can I get serial number of harddrive using "pure" .NET, without Win API? Thanx
2
by: Abubakar | last post by:
I have been trying to write a code that will give me the serial number of a harddrive or that of a motherboard, but i don't seem to get it right. Do anybody out there have any idea?
3
by: Abubakar | last post by:
I have been trying to write a code that will enable me get the serial number of the motherboard or harddrive on a given system but no luck so far. Can any one out there help me.
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
2
by: sheperson | last post by:
Hi, I have been working for several months on a sofware and now it is finished. I have a problem now and it is this: Because I live in a country which there is no copyright law in it (Iran!!!!)....
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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: 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
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.