Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class in c# which gives the information about the machine

Tags:

c#

I want to get the information about the the machine configuration i.e like ip address of the machine

like image 771
shefy Avatar asked Dec 17 '22 00:12

shefy


2 Answers

you may use Dns for ip/host information and Environment for generic system information (os, version)

like image 149
Alex Pacurar Avatar answered Dec 24 '22 00:12

Alex Pacurar


For general machine information, you'll want to use WMI. It is supported by the classes in the System.Management namespace, in particular the ManagementQuery class.

The best way to get started on this is the WmiCodeCreator utility. It lets you discover what WMI classes are available on the machine and run queries. Best of all, it auto-generates the C# code you need, ready to cut-and-paste into your program. Strongly recommended.

like image 43
Hans Passant Avatar answered Dec 24 '22 01:12

Hans Passant