System.out.println("=> Perform a query : What logical disks do we have ?");
// Select informations
ISWbemObjectSet result = wbemServices.execQuery("Select * from Win32_LogicalDisk", "WQL", 16, null);
// Display query results
for (Com4jObject obj : result) {
ISWbemObject wo = obj.queryInterface(ISWbemObject.class);
System.out.println(wo.getObjectText_(0));
}
/* Perform a query : What USB drives do we have ? */
System.out.println("=> Perform a query : What USB drives do we have ?");
// Select informations
result = wbemServices.execQuery("Select * from Win32_USBDevice", "WQL", 16, null);
// Display query results
for (Com4jObject obj : result) {
ISWbemObject wo = obj.queryInterface(ISWbemObject.class);
System.out.println(wo.getObjectText_(0));
}
/* Perform a query : What is the datetime ? */
System.out.println("=> Perform a query : What is the datetime ?");
// Select informations
result = wbemServices.execQuery("Select * from Win32_LocalTime", "WQL", 16, null);
// Display query results
for (Com4jObject obj : result) {
ISWbemObject wo = obj.queryInterface(ISWbemObject.class);
System.out.println(wo.getObjectText_(0));
}
/* Perform a query : How many logon session do we have ? */
System.out.println("=> Perform a query : How many logon session do we have ?");
// Select informations
result = wbemServices.execQuery("Select * from Win32_LogonSession", "WQL", 16, null);
// Display query results
for (Com4jObject obj : result) {
ISWbemObject wo = obj.queryInterface(ISWbemObject.class);
System.out.println(wo.getObjectText_(0));
}
/* Perform a query : How many share do we have ? */
System.out.println("=> Perform a query : How many share do we have ?");
// Select informations
result = wbemServices.execQuery("Select * from Win32_Share", "WQL", 16, null);
// Display query results
for (Com4jObject obj : result) {
ISWbemObject wo = obj.queryInterface(ISWbemObject.class);
System.out.println(wo.getObjectText_(0));
}
/* Perform a query : How many network connection do we have ? */
System.out.println("=> Perform a query : How many network connection do we have ?");
// Select informations
result = wbemServices.execQuery("Select * from Win32_NetworkConnection", "WQL", 16, null);
// Display query results
for (Com4jObject obj : result) {
ISWbemObject wo = obj.queryInterface(ISWbemObject.class);
System.out.println(wo.getObjectText_(0));
}
/* Perform a query : How many account SID do we have ? */
System.out.println("=> Perform a query : How many account SID do we have ?");
// Select informations
result = wbemServices.execQuery("Select * from Win32_AccountSID", "WQL", 16, null);
// Display query results
for (Com4jObject obj : result) {
ISWbemObject wo = obj.queryInterface(ISWbemObject.class);
System.out.println(wo.getObjectText_(0));
}
} catch (Exception e) {
e.printStackTrace();
} finally {