Skip to content

WMI Query

Namhyeon, Go edited this page Jun 5, 2022 · 2 revisions

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"));
Clone this wiki locally