Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › [C#]How to access System.Machine object?
New Posts  All Forums:Forum Nav:

[C#]How to access System.Machine object?

post #1 of 20
Thread Starter 
I tried directly accessing it but it says it doesn't exist in my namespace. Not sure what to do about this.
Lee XT
(17 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX-6300 Asus M5A97 SAPPHIRE Radeon HD 7850 AMD 4GB DDR3 1333MHZ 
RAMRAMRAMHard Drive
AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ OCZ Vertex 4 256GB 
CoolingOSMonitorKeyboard
Corsair H80 Windows 8.1 Pro MCE Dell P2414H WHXV7  Microsoft Generic 
PowerCaseMouseMouse Pad
Ultra 600W Limited Edition NZXT Black Steel Razer Deathadder Razer Goliath 
Audio
Realtek HD Audio 
  hide details  
Reply
Lee XT
(17 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX-6300 Asus M5A97 SAPPHIRE Radeon HD 7850 AMD 4GB DDR3 1333MHZ 
RAMRAMRAMHard Drive
AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ OCZ Vertex 4 256GB 
CoolingOSMonitorKeyboard
Corsair H80 Windows 8.1 Pro MCE Dell P2414H WHXV7  Microsoft Generic 
PowerCaseMouseMouse Pad
Ultra 600W Limited Edition NZXT Black Steel Razer Deathadder Razer Goliath 
Audio
Realtek HD Audio 
  hide details  
Reply
post #2 of 20
Licht, not sure if you added the System.Machine reference to your project, but what you need to do is from the solution explorer, select the project. Then on the project menu choose "Add Reference". From there you should be able to select the .NET Components and then select System.Machine.

Let me know how that works out for you... i'll try it on one of my dev boxes and make sure the above is correct... just speaking from memory atm.
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
INTEL Core 2 Duo E8400 3.00 GHz 1333 MHz 775 6MB EVGA 132-CK-NF78-A1 NVIDIA nForce 780i 2x eVGA GeForce 8800 GTS 640 4gb Corsair Dominator Series TWIN2X2048-8500C5D 
Hard DriveOSMonitorKeyboard
4x Western Digital 150gb Raptor 10,000 RPM Microsoft Vista x64 Ultimate 2x Samsung 226BW 22" Monitors Logitech g15 gaming keyboard 
Case
Antec Nine Hundred 
  hide details  
Reply
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
INTEL Core 2 Duo E8400 3.00 GHz 1333 MHz 775 6MB EVGA 132-CK-NF78-A1 NVIDIA nForce 780i 2x eVGA GeForce 8800 GTS 640 4gb Corsair Dominator Series TWIN2X2048-8500C5D 
Hard DriveOSMonitorKeyboard
4x Western Digital 150gb Raptor 10,000 RPM Microsoft Vista x64 Ultimate 2x Samsung 226BW 22" Monitors Logitech g15 gaming keyboard 
Case
Antec Nine Hundred 
  hide details  
Reply
post #3 of 20
I am not aware of C# has System.Machine namespace but the System.Management namespace should have all functionalities to retrieve all information from the local machine.
post #4 of 20
Thread Starter 
Quote:
Originally Posted by njNET View Post
Licht, not sure if you added the System.Machine reference to your project, but what you need to do is from the solution explorer, select the project. Then on the project menu choose "Add Reference". From there you should be able to select the .NET Components and then select System.Machine.

Let me know how that works out for you... i'll try it on one of my dev boxes and make sure the above is correct... just speaking from memory atm.
I can't find it in .Net 3.5 (latest.)

Quote:
I am not aware of C# has System.Machine namespace but the System.Management namespace should have all functionalities to retrieve all information from the local machine.
I'm more looking for CPU name and other information along those lines.
Lee XT
(17 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX-6300 Asus M5A97 SAPPHIRE Radeon HD 7850 AMD 4GB DDR3 1333MHZ 
RAMRAMRAMHard Drive
AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ OCZ Vertex 4 256GB 
CoolingOSMonitorKeyboard
Corsair H80 Windows 8.1 Pro MCE Dell P2414H WHXV7  Microsoft Generic 
PowerCaseMouseMouse Pad
Ultra 600W Limited Edition NZXT Black Steel Razer Deathadder Razer Goliath 
Audio
Realtek HD Audio 
  hide details  
Reply
Lee XT
(17 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX-6300 Asus M5A97 SAPPHIRE Radeon HD 7850 AMD 4GB DDR3 1333MHZ 
RAMRAMRAMHard Drive
AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ OCZ Vertex 4 256GB 
CoolingOSMonitorKeyboard
Corsair H80 Windows 8.1 Pro MCE Dell P2414H WHXV7  Microsoft Generic 
PowerCaseMouseMouse Pad
Ultra 600W Limited Edition NZXT Black Steel Razer Deathadder Razer Goliath 
Audio
Realtek HD Audio 
  hide details  
Reply
post #5 of 20
Do you have to specifically use System.Machine? I'm not at home at the moment, but this looks promising:

http://www.codeproject.com/KB/system...formation.aspx
RAID0R
(14 items)
 
  
CPUMotherboardGraphicsRAM
i5 750 4.0GHz MSI P55-GD80 GTX 470 | 8800GT PhysX 2x2GB G.Skill Ripjaws 
Hard DriveOptical DriveCoolingOS
60GB Agility 2|1TB RAID0|1.5TB Pioneer DVR-217D XSPC Raystorm | XSPC RX240 Windows 7 Professional x64 
MonitorKeyboardPowerCase
27" Dell 2709W | 17" Samsung Logitech G15 Corsair HX850 Corsair 650D 
Mouse
Microsoft IntelliMouse 
  hide details  
Reply
RAID0R
(14 items)
 
  
CPUMotherboardGraphicsRAM
i5 750 4.0GHz MSI P55-GD80 GTX 470 | 8800GT PhysX 2x2GB G.Skill Ripjaws 
Hard DriveOptical DriveCoolingOS
60GB Agility 2|1TB RAID0|1.5TB Pioneer DVR-217D XSPC Raystorm | XSPC RX240 Windows 7 Professional x64 
MonitorKeyboardPowerCase
27" Dell 2709W | 17" Samsung Logitech G15 Corsair HX850 Corsair 650D 
Mouse
Microsoft IntelliMouse 
  hide details  
Reply
post #6 of 20
Thread Starter 
Quote:
Originally Posted by C-bro View Post
Do you have to specifically use System.Machine? I'm not at home at the moment, but this looks promising:

http://www.codeproject.com/KB/system...formation.aspx
I like how much info is there that i can access! Even voltage... Thank you, thank you! I'll definitely see about using this. (Busy at the moment though.)
Lee XT
(17 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX-6300 Asus M5A97 SAPPHIRE Radeon HD 7850 AMD 4GB DDR3 1333MHZ 
RAMRAMRAMHard Drive
AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ OCZ Vertex 4 256GB 
CoolingOSMonitorKeyboard
Corsair H80 Windows 8.1 Pro MCE Dell P2414H WHXV7  Microsoft Generic 
PowerCaseMouseMouse Pad
Ultra 600W Limited Edition NZXT Black Steel Razer Deathadder Razer Goliath 
Audio
Realtek HD Audio 
  hide details  
Reply
Lee XT
(17 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX-6300 Asus M5A97 SAPPHIRE Radeon HD 7850 AMD 4GB DDR3 1333MHZ 
RAMRAMRAMHard Drive
AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ OCZ Vertex 4 256GB 
CoolingOSMonitorKeyboard
Corsair H80 Windows 8.1 Pro MCE Dell P2414H WHXV7  Microsoft Generic 
PowerCaseMouseMouse Pad
Ultra 600W Limited Edition NZXT Black Steel Razer Deathadder Razer Goliath 
Audio
Realtek HD Audio 
  hide details  
Reply
post #7 of 20
BTW, forgot to add, the System.Machine namespace is in the SDK for the windows sidebar.

http://msdn.microsoft.com/en-us/libr...60(VS.85).aspx
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
INTEL Core 2 Duo E8400 3.00 GHz 1333 MHz 775 6MB EVGA 132-CK-NF78-A1 NVIDIA nForce 780i 2x eVGA GeForce 8800 GTS 640 4gb Corsair Dominator Series TWIN2X2048-8500C5D 
Hard DriveOSMonitorKeyboard
4x Western Digital 150gb Raptor 10,000 RPM Microsoft Vista x64 Ultimate 2x Samsung 226BW 22" Monitors Logitech g15 gaming keyboard 
Case
Antec Nine Hundred 
  hide details  
Reply
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
INTEL Core 2 Duo E8400 3.00 GHz 1333 MHz 775 6MB EVGA 132-CK-NF78-A1 NVIDIA nForce 780i 2x eVGA GeForce 8800 GTS 640 4gb Corsair Dominator Series TWIN2X2048-8500C5D 
Hard DriveOSMonitorKeyboard
4x Western Digital 150gb Raptor 10,000 RPM Microsoft Vista x64 Ultimate 2x Samsung 226BW 22" Monitors Logitech g15 gaming keyboard 
Case
Antec Nine Hundred 
  hide details  
Reply
post #8 of 20
Thread Starter 
Quote:
Originally Posted by njNET View Post
BTW, forgot to add, the System.Machine namespace is in the SDK for the windows sidebar.

http://msdn.microsoft.com/en-us/libr...60(VS.85).aspx
Also very good information, that SDK may be useful in the future.
Lee XT
(17 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX-6300 Asus M5A97 SAPPHIRE Radeon HD 7850 AMD 4GB DDR3 1333MHZ 
RAMRAMRAMHard Drive
AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ OCZ Vertex 4 256GB 
CoolingOSMonitorKeyboard
Corsair H80 Windows 8.1 Pro MCE Dell P2414H WHXV7  Microsoft Generic 
PowerCaseMouseMouse Pad
Ultra 600W Limited Edition NZXT Black Steel Razer Deathadder Razer Goliath 
Audio
Realtek HD Audio 
  hide details  
Reply
Lee XT
(17 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX-6300 Asus M5A97 SAPPHIRE Radeon HD 7850 AMD 4GB DDR3 1333MHZ 
RAMRAMRAMHard Drive
AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ OCZ Vertex 4 256GB 
CoolingOSMonitorKeyboard
Corsair H80 Windows 8.1 Pro MCE Dell P2414H WHXV7  Microsoft Generic 
PowerCaseMouseMouse Pad
Ultra 600W Limited Edition NZXT Black Steel Razer Deathadder Razer Goliath 
Audio
Realtek HD Audio 
  hide details  
Reply
post #9 of 20
Quote:
Originally Posted by Licht View Post
I can't find it in .Net 3.5 (latest.)



I'm more looking for CPU name and other information along those lines.
The System.Management has it all - software as well as hardware information.

ManagementObjectSearcher Srch1 = new ManagementObjectSearcher("SELECT * FROM Win32_BIOS");
foreach (ManagementObject mobj in Srch1.Get())
{
Console.WriteLine(Srch1.ToString());
}
post #10 of 20
Thread Starter 
Quote:
Originally Posted by linskingdom View Post
The System.Management has it all - software as well as hardware information.

ManagementObjectSearcher Srch1 = new ManagementObjectSearcher("SELECT * FROM Win32_BIOS");
foreach (ManagementObject mobj in Srch1.Get())
{
Console.WriteLine(Srch1.ToString());
}
Time to revive an old thread.

Your code throws this.

Code:
Error    1    The type or namespace name 'ManagementObjectSearcher' could not be found (are you missing a using directive or an assembly reference?)    C:UsersLichtDocumentsDoubleMarkDoubleMarkForm1.cs    18    9    DoubleMark
Lee XT
(17 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX-6300 Asus M5A97 SAPPHIRE Radeon HD 7850 AMD 4GB DDR3 1333MHZ 
RAMRAMRAMHard Drive
AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ OCZ Vertex 4 256GB 
CoolingOSMonitorKeyboard
Corsair H80 Windows 8.1 Pro MCE Dell P2414H WHXV7  Microsoft Generic 
PowerCaseMouseMouse Pad
Ultra 600W Limited Edition NZXT Black Steel Razer Deathadder Razer Goliath 
Audio
Realtek HD Audio 
  hide details  
Reply
Lee XT
(17 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX-6300 Asus M5A97 SAPPHIRE Radeon HD 7850 AMD 4GB DDR3 1333MHZ 
RAMRAMRAMHard Drive
AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ OCZ Vertex 4 256GB 
CoolingOSMonitorKeyboard
Corsair H80 Windows 8.1 Pro MCE Dell P2414H WHXV7  Microsoft Generic 
PowerCaseMouseMouse Pad
Ultra 600W Limited Edition NZXT Black Steel Razer Deathadder Razer Goliath 
Audio
Realtek HD Audio 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › [C#]How to access System.Machine object?