The Java Web-Based Enterprise Management (JWbem) is an on-going Java implementation of Microsoft's Scripting Web-Based Enterprise Management (SWbem) API. JWbem allows Java developers to easily monitor and manage Microsoft Windows via Windows Management Instrumentation (WMI).


What can you do with JWbem? Simple. JWbem utilizes j-Interop to provide a very easy framework for Java developers to remotely manage and monitor Microsoft Windows computer systems via familiar WMI syntax.

Establish a connection to a Windows server

This example shows how to connect to a remote Hyper-V server's virtualization namespace.

import com.hyper9.jwbem.SWbemLocator;
import com.hyper9.jwbem.SWbemServices;


// The IP address or FQDN of the Windows server to connect to.
String serverName = "hyperv.hyper9.local";
// The CIM namespace to connect to.
String cimNamespace = "root\\virtualization";
// The name of the user to connect as. The format of the user name supports
String userName = "Hyper9\\akutz";
// The passprase for the given user.
String passphrase = "passphrase";
// Create a locator object.
SWbemLocator loc = new SWbemLocator();

// Connect to the Windows server and return a services object.
SWbemServices svc = loc.connect(serverName, "", cimNamespace, username, passphrase);

List all of a Hyper-V server's virtual machines

This example shows how to enumerate all of the virtual machines on the Hyper-V server we established a connection to in the previous example.

import com.hyper9.jwbem.SWbemObjectSet;
import com.hyper9.jwbem.msvm.MsvmComputerSystem;


// Define the WQL query that returns all of a Hyper-V's virtual machines.
String wql = "SELECT * FROM Msvm_ComputerSystem WHERE Caption='Virtual Machine'";

// Execute the query.
SWbemObjectSet<MsvmComputerSystem> compSysSet = svc.execQuery(wql, MsvmComputerSystem.class);

// Print the names of the virtual machines.
for (MsvmComputerSystem cs : compSysSet)