Hi , i am retrieving machine details using c# and wmi . i using following code to retrieve information:
ManagementScope scope =new ManagementScope(@"\\"+strIPAddress+@"\root\cimv2");
SelectQuery query = new SelectQuery();
query.QueryString = "select * from Win32_OperatingSystem";
ManagementObjectSearcher searcher =new ManagementObjectSearcher(scope, query);
ManagementObjectCollection queryCollection = searcher.Get();
foreach (ManagementObject m in queryCollection)
{
}
it is working fine for windows operating system. but it does not works for linux , Citrix server,
i have also tried this code :
string strURL="http://www.google.com";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(strURL);
try
{
HttpWebResponse response =(HttpWebResponse) request.GetResponse();
string strServer= response.Server;
}
catch (WebException wex)
{
var httpWebResponse = wex.Response as HttpWebResponse;
if (httpWebResponse != null)
{
var httpStatusCode = httpWebResponse.StatusCode;
var httpStatusCodeInt = (int)httpWebResponse.StatusCode;
}
}
but it does not gives me the remote server os name rather it gives me IIS name.
when i searched over internet, i found the following site:
http://uptime.netcraft.com/[
^]
where anyone can retrieve information. can anyone tell how is it works or how we can fetch these details using c#.
Thanks,
Arshad