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.
host
(type: string) - Hostname or IP of the client to get information from. Defaults tolocalhost
.namespace
(type: string) - Namespace of the class to query. Defaults toroot\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 = ;wmi;
// Chainable API reference with exec method var wmi = ;wmi;
// Using callback in chainable api var wmi = ;wmi;