Hi All,
How can I programatically get the Computer description? I'm using C# and .NET 2.0.
I tried Console.WriteLine(Dns.GetHostName());
but it echoes the Full computer name
instead.
I also used the following code:
ManagementObjectSearcher query1 = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem") ;
ManagementObjectCollection queryCollection1 = query1.Get();
foreach( ManagementObject mo in queryCollection1 )
{
Console.WriteLine(mo["Description"].ToString());
}
But this seems doesn't work, I got this exception:
Exception System.IO.FileNotFoundException was thrown in debuggee:
Could not load file or assembly 'System.Management, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.