title: retrieve remote machine details using c# , wmi
body: <p>I'm retrieving machine details using c# and wmi. I'm using the following code to retrieve information:</p>
  
  <pre><code>        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)
          {
           //////////////////////////////////
          }
  </code></pre>
  
  <p>It's working fine for windows operating system, but it doesn't work for linux or Citrix server. </p>
  
  <p>I've also tried this code below :</p>
  
  <pre><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)
          {
            // Safe cast to HttpWebResponse using 'as', will return null if unsuccessful
              var httpWebResponse = wex.Response as HttpWebResponse;
              if (httpWebResponse != null)
              {
                  var httpStatusCode = httpWebResponse.StatusCode;
  
                  // HttpStatusCode is an enum, cast it to int for its actual value
                  var httpStatusCodeInt = (int)httpWebResponse.StatusCode;
              }
          }
  </code></pre>
  
  <p>It doesn't  give me the remote server os name, rather it gives me IIS name.</p>
  
  <p>When I searched over internet, I found the following site:</p>
  
  <p><a href="http://uptime.netcraft.com/" rel="nofollow">http://uptime.netcraft.com/</a></p>
  
  <p>Where anyone can retrieve information. Can anyone tell me how  it works or how we can fetch these details using c#.</p>