How to use the wmic.get_value function in wmic

To help you get started, we’ve selected a few wmic examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tomas / network / lib / win32.js View on Github external
exports.mac_address_for(nic_name, function(err, mac){
    if (err || !mac)
      return cb(err || new Error('No MAC Address found.'));

    wmic.get_value('nicconfig', what, 'MACAddress = \'' + mac + '\'', function(err, out){
      if (err) return cb(err);

      cb(null, out.split(',')[0].replace(/[^0-9\.]/g, ''));
    });
  })
}
github prey / prey-node-client / lib / system / windows / index.js View on Github external
exports.find_logged_user = function(callback) {
  wmic.get_value('computersystem', 'username', null, function(err, stdout) {
    if (err || stdout.toString().trim() == '')
      return callback(err || new Error('No logged user found.'));

    var out = stdout.toString().split("\\"),
        user = clean_string(out[out.length-1]);

    if (!user  || user == '' || user == 'undefined')
      return callback(err || new Error('No logged user found.'));

    callback(null, user);
  });
};
github prey / prey-node-client / lib / agent / providers / hardware / windows.js View on Github external
var fetch = function(key, section, value){
    wmic.get_value(section, value, null, function(err, res){
      if (key == 'device_type'){
        res = err ? 'Desktop' : 'Laptop'
		data[key] = res;
	  }
      if (!err && res)
        data[key] = res;

      --count || callback(null, data)
    })
  }
github tomas / network / lib / win32.js View on Github external
exports.mac_address_for = function(nic_name, cb) {
  var cond = 'NetConnectionID = \'' + nic_name + '\'';
  wmic.get_value('nic', 'MACAddress', cond, cb);
}

wmic

Wrapper around the WMIC Windows command interface.

MIT
Latest version published 2 years ago

Package Health Score

47 / 100
Full package analysis