Giter VIP home page Giter VIP logo

node-wmi's Introduction

node-wmi

Library to execute wmi (Windows Management Instrumentation) commands.

Install

npm install node-wmi

Documentation

Methods

Query([options, callback])

Constructor that generates an instance of the Query class.

Arguments

  • options - Object representing options for the query. Options can also be applied via chain api. (optional)
  • callback(err, result) - Callback. If not supplied query will not be executed until query.exec() method has been called. (optional)

Return Value The Query method returns an instance of the query class.

Options Properties

  • host (type: string) - Hostname or IP of the client to get information from. Defaults to localhost.
  • namespace (type: string) - Namespace of the class to query. Defaults to root\CIMV2.
  • class (type:string) - Class to be queried for information. (required)
  • properties/props (type: [string])- List of properties of the class to query for. If not set, all properties will be returned for the given class. (optional)
  • username (type: string) - Username to use to perform query. (optional)
  • password (type: string) - Password for the above username. (optional)
  • where (types: string, [string]) - Where clause for the query. The where clause can come in multiple different types. If you pass in a string, it will be accepted as a literal text to go in the where clause. If you pass in an array of strings, they will be And'ed together. (optional)

Chainable API Chainable api methods exists to set each property for the query. To use the chainable api, call the method of the name of the property which you would like to set with the first argument being the value of the property and an optional second argument being a callback function to execute the query.

Callback The callback has the signature of (err, result). The callback can be supplied as the second argument to either the constructor or any of the chainable functions. The callback is the first and only parameter for the exec method.

Examples

// Object usage

var wmi = require('node-wmi');
wmi.Query({
  class: 'Win32_BIOS'
}, function(err, bios) {
  console.log(bios);
});
// Chainable API reference with exec method

var wmi = require('node-wmi');
wmi.Query().class('Win32_BIOS').exec(function(err, bios) {
  console.log(bios);
});
// Using callback in chainable api

var wmi = require('node-wmi');
wmi.Query().class('Win32_LogicalDisk', function(err, disks) {
  console.log(disks);
});

node-wmi's People

Contributors

jgrusling avatar vertigoray avatar jpgrusling avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.