WMIHelper ClassCleanCode C# Libraries v1.2.03 API
Streamlines access to the OnlineWMI.
Inheritance Hierarchy

OnlineSystem Object
  CleanCode.Net WMIHelper

Namespace: CleanCode.Net
Assembly: CleanCode (in CleanCode.dll) Version: (1.2.03)

public class WMIHelper

WMI (Windows Management Instrumentation) allows querying remote computers for key data. The full WMI allows control of remote computers as well. WMIHelper provides some support methods to streamline access. For a list of sections and keys, see the OnlineWMI reference. Also, OnlineWMI Explorer is useful for actually exploring values returned by WMI.

Since CleanCode 0.9.07.


The first step is to create an instance using one of the constructors. You may specify a remote host with or without a section:
wmiHelper = new WMIHelper(server, domain, user, pwd);
wmiHelper = new WMIHelper(server, domain, user, pwd, section);
wmiHelper = new WMIHelper();
wmiHelper = new WMIHelper(section);
or a local host likewise: Next invoke the Connect  method to connect the scope.
And now you are ready to execute queries. If you pre-selected a section in the constructor, you only need the single-argument GetInfo(String). If you did not, or you want to change the section, then you use the SetSection(String) method or the dual-argument GetInfo(String, String).
string serverOSName = wmiHelper.GetInfo("Caption");
string serverIPLabel = wmiHelper.GetInfo(
    "Win32_NetworkAdapterConfiguration", "IPAddress");
See Also