473,786 Members | 2,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Serial number of Harddrive

Hi ALL,

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

Thanx
Nov 15 '05 #1
3 5302
On Sat, 29 Nov 2003 03:02:29 +0100, "Evgeny Zoldin"
<ez*****@hotmai l.com> wrote:
Hi ALL,

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

Thanx

using System.Manageme nt;
//be sure to reference the System.Managmen t.dll

string GetSerialNumber (string drive)
{
ManagementObjec t disk=new
ManagementObjec t("win32_logica ldisk.deviceid= \"" + drive + ":\"");
return
disk.Properties["VolumeSerialNu mber"].Value.ToString ());
}
Nov 15 '05 #2
Also check out the other properties of some of the other WMI classes
(Win32_Physical Media 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************ ***********@hot mail.com> wrote in message
news:fu******** *************** *********@4ax.c om...
On Sat, 29 Nov 2003 03:02:29 +0100, "Evgeny Zoldin"
<ez*****@hotmai l.com> wrote:
Hi ALL,

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

using System.Manageme nt;
//be sure to reference the System.Managmen t.dll

string GetSerialNumber (string drive)
{
ManagementObjec t disk=new
ManagementObjec t("win32_logica ldisk.deviceid= \"" + drive + ":\"");
return
disk.Properties["VolumeSerialNu mber"].Value.ToString ());
}

Nov 15 '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*******@Atre vido.net> wrote in message
news:uZ******** ******@tk2msftn gp13.phx.gbl...
Also check out the other properties of some of the other WMI classes
(Win32_Physical Media 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************ ***********@hot mail.com> wrote in message
news:fu******** *************** *********@4ax.c om...
On Sat, 29 Nov 2003 03:02:29 +0100, "Evgeny Zoldin"
<ez*****@hotmai l.com> wrote:
Hi ALL,

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

using System.Manageme nt;
//be sure to reference the System.Managmen t.dll

string GetSerialNumber (string drive)
{
ManagementObjec t disk=new
ManagementObjec t("win32_logica ldisk.deviceid= \"" + drive + ":\"");
return
disk.Properties["VolumeSerialNu mber"].Value.ToString ());
}


Nov 15 '05 #4

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

Similar topics

15
9692
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
3
1692
by: Evgeny Zoldin | last post by:
Hi ALL, how can I get serial number of harddrive using "pure" .NET, without Win API? Thanx
5
2693
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
14121
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 operating system would be appropriate. However, I do not know how to retrieve the information. Could you help? Klaus
3
3279
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 query should find every machine that has that part number between the serial number range. The problem is that the serial number stored is a text field and the results are not what they should be.
2
16169
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
7739
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
1734
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
12679
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!!!!). As soon as I give the software to some customers, the software will be copied illegally and I don't want this happen. Now I wonder if anyone could help me on how to create a lock or a serial number for the software. I want my software to...
0
9647
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9492
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,...
0
10360
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10163
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8988
agi2029
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...
0
6744
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();...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4064
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 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.