473,770 Members | 2,028 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
Jul 21 '05 #1
3 1691
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 ());
}
Jul 21 '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 ());
}

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*******@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 ());
}


Jul 21 '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
5
2692
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
14120
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.
3
5301
by: Evgeny Zoldin | last post by:
Hi ALL, how can I get serial number of harddrive using "pure" .NET, without Win API? Thanx
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
7737
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
9454
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
9906
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8933
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...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5354
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
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.