2 WMI Query
Namhyeon, Go edited this page 2022-06-05 20:11:30 +09:00

WMI Query

Get list of processes

var WMI = require("lib/wmi");

var getProcesses = function() {
    return WMI.execQuery("Select * From Win32_Process").fetchAll();
};

Test network ping

var WMI = require("lib/wmi");

var ping = function(address) {
    return WMI.execQuery("Select * From Win32_PingStatus where address='" + address + "'").fetch().get("ResponseTime");
};
console.log(ping("1.1.1.1"));

Test network ping (with squel.js)

var WMI = require("lib/wmi");

var ping = function(address) {
    var sqlString = squel.select("Win32_PingStatus").where("address = ?", address).toString();
    return WMI.execQuery(sqlString).fetch().get("ResponseTime");
};
console.log(ping("1.1.1.1"));