473,385 Members | 1,357 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.

CPU or HD Serial

Anyone knows how can i get the cpu serial or the hd serial of the machine
runnig the application with c#?
regards
Gianmaria
Nov 15 '05 #1
3 9792
Gianmaria,

You should use the classes in the System.Management namespace to run a
WMI query on the system. There is one instance of the Win32_Processor class
for each processor on a machine. You should be able to use the DeviceID
property here to get the unique id of the processor. For the hard drives,
you should be able to get all instances of the Win32_DiskDrive class and
then use the DeviceID property on that class.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Gianmaria" <no*************@telenet.it> wrote in message
news:ek**************@TK2MSFTNGP10.phx.gbl...
Anyone knows how can i get the cpu serial or the hd serial of the machine
runnig the application with c#?
regards
Gianmaria

Nov 15 '05 #2
I guess you could find it out from HKLM/Hardware in the registry...

You could use Microsoft.Win32 namespace - RegistryKey class.

Hope this helps.

-Diwakar
"Gianmaria" <no*************@telenet.it> wrote in message
news:ek**************@TK2MSFTNGP10.phx.gbl...
Anyone knows how can i get the cpu serial or the hd serial of the machine
runnig the application with c#?
regards
Gianmaria

Nov 15 '05 #3
Gianmaria,

You must be aware that not all CPUs have serial numbers available (remeber a
huge controversy over Intel decision to enable CPU serial numbers a couple
of yers ago?).

This is how you can get CPU serial number (or numbers in case it is a
multi-CPU machine):

using System;
using System.Management;
....
SelectQuery query = new SelectQuery("Win32_BaseBoard");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
ManagementObjectCollection coll = searcher.Get();

foreach (ManagementObject obj in coll)
Console.WriteLine("Win32_BaseBoard: SerialNumber = " +
obj.Properties["SerialNumber"].Value);

You can use a similar approach to get the serial number of a hard drive.

Alek

"Gianmaria" <no*************@telenet.it> wrote in message
news:ek**************@TK2MSFTNGP10.phx.gbl...
Anyone knows how can i get the cpu serial or the hd serial of the machine
runnig the application with c#?
regards
Gianmaria

Nov 15 '05 #4

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

Similar topics

4
by: ^CeFoS^ | last post by:
Hello to everybody, I've done an application that draws in a frame the trajectory of a robot. The robot position is readed through the serial port, and several commands are wrote through the...
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
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...
13
by: Al the programmer | last post by:
I need to access the serial ports on my webserver from an asp.net page. I have no problem accessing the serial ports from a windows form application, but the code doesn't work in asp.net. I have...
13
by: Rob | last post by:
Hi all, I am fairly new to python, but not programming and embedded. I am having an issue which I believe is related to the hardware, triggered by the software read I am doing in pySerial. I...
2
by: joaquimfpinto | last post by:
Dear All, I made an app in c# that uses several serial ports. For the serial ports I use a pnp Sunix board, some with 8 serial ports other with 4 or even 2 serial ports. Whenever I use the...
4
by: rowan | last post by:
I'm writing a driver in Python for an old fashioned piece of serial equipment. Currently I'm using the USPP serial module. From what I can see all the serial modules seem to set the timeout when...
3
by: naveen.sabapathy | last post by:
Hi, I am trying to use virtual serial ports to develop/test my serial communication program. Running in to trouble... I am using com0com to create the virtual ports. The virtual ports seem to...
6
by: terry | last post by:
Hi, I am trying to send a character to '/dev/ttyS0' and expect the same character and upon receipt I want to send another character. I tired with Pyserial but in vain. Test Set up: 1. Send...
1
by: lutherchp | last post by:
A baffling end to my week! I open my serial port on my Debian PC (Debian version 5.0.1) I have a decent Null Modem lead going to another PC (I'll call it PC#2), with its port open with the same...
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...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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: 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...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.