Windows Management Instrumentation (WMI) from Java 

This post shows how to instrument Windows resources using WMI and Java. The attached source code has 3 programs:

  1. PrintInstances.java prints all instances of a given class. For e.g., to retrieve a list of services use Win32_Service in WML.
  2. SimpleServiceManager.java starts or stops a given service.
  3. ServiceManager.java starts or stops a service by starting/stopping any dependents.