WbemcliUtil (JNA API)
Description: declaration: package: com.sun.jna.platform.win32.COM, class: WbemcliUtil

Package com.sun.jna.platform.win32.COM

# Class WbemcliUtil

java.lang.Object
com.sun.jna.platform.win32.COM.WbemcliUtil

public class WbemcliUtil extends Object
Utility class providing access to Windows Management Interface (WMI) via COM.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `WbemcliUtil.WmiQuery<T extends Enum<T>>`
  Helper class wrapping information required for a WMI query.
  `class`
  `WbemcliUtil.WmiResult<T extends Enum<T>>`
  Helper class wrapping an EnumMap containing the results of a query.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `DEFAULT_NAMESPACE`
  The default namespace for most WMI queries.
  `static final WbemcliUtil`
  `INSTANCE`
  Instance to generate the WmiQuery class.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `WbemcliUtil()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Wbemcli.IWbemServices`
  `connectServer(String namespace)`
  Obtains a locator to the WMI server and connects to the specified namespace
  `static boolean`
  `hasNamespace(String namespace)`
  Determine if WMI has the requested namespace.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### INSTANCE

    public static final WbemcliUtil INSTANCE
    Instance to generate the WmiQuery class.

  - ### DEFAULT_NAMESPACE

    public static final String DEFAULT_NAMESPACE
    The default namespace for most WMI queries.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### WbemcliUtil

    public WbemcliUtil()

- ## Method Details

  - ### hasNamespace

    public static boolean hasNamespace(String namespace)
    Determine if WMI has the requested namespace. Some namespaces only exist on newer versions of Windows.
    Parameters:
      `namespace` - The namespace to test
    Returns:
      true if the namespace exists, false otherwise

  - ### connectServer

    public static Wbemcli.IWbemServices connectServer(String namespace)
    Obtains a locator to the WMI server and connects to the specified namespace
    Parameters:
      `namespace` - The namespace to connect to
    Returns:
      A service representing the connected namespace, which can be queried. This service may be re-used for multiple queries and should be released by the user