title: Query QWINSTA in C#
body: <p>So I while back I had to detect the routings in C# for which I used the following code.</p>
  
  <pre><code>        ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_IP4RouteTable");
  
          foreach (ManagementObject queryObj in searcher.Get())
          {
              string destination = queryObj["Destination"].ToString();
              string mask = queryObj["Mask"].ToString();
              string metric = queryObj["Metric1"].ToString();
              string interfaceIndex = queryObj["InterfaceIndex"].ToString();
              string nexthop = queryObj["NextHop"].ToString();
              ...
          }
  </code></pre>
  
  <p>Now I wan't to be able to logoff a remote desktop session. I Know I can do this with qwinsta commands in but I was wondering if there was some way I can get the results of qwinsta into C# like the solution above for netstat.</p>