mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-06 06:54:58 +00:00
Update WMI.js
This commit is contained in:
parent
d0c6cb89f2
commit
2aa60e0dcf
8
app.js
8
app.js
|
@ -97,12 +97,6 @@ if (typeof(CreateObject) !== "function") {
|
|||
};
|
||||
}
|
||||
|
||||
if (typeof(GetObject) !== "function") {
|
||||
var GetObject = function(pathName, className) {
|
||||
console.error("Not supported on this environment.");
|
||||
};
|
||||
}
|
||||
|
||||
function require(FN) {
|
||||
var cache = require.__cache = require.__cache || {};
|
||||
if (FN.substr(FN.length - 3) !== '.js') FN += ".js";
|
||||
|
@ -243,7 +237,7 @@ require("app/assets/js/es6-sham-0.35.5.min");
|
|||
// Babel-core browser-polyfill
|
||||
require("app/assets/js/babel-core-browser-polyfill-5.8.38.min");
|
||||
|
||||
// dive into entrypoint
|
||||
// dive into entrypoint
|
||||
function main() {
|
||||
if (typeof(window) === "undefined") {
|
||||
init_console();
|
||||
|
|
15
lib/wmi.js
15
lib/wmi.js
|
@ -6,7 +6,8 @@ var WMIObject = function() {
|
|||
var wbemFlagReturnImmediately = 0x10;
|
||||
var wbemFlagForwardOnly = 0x20;
|
||||
|
||||
this.server = ".";
|
||||
this.computer = ".";
|
||||
this.namespace = "root\\cimv2";
|
||||
this.interface = null;
|
||||
this.cursor = {};
|
||||
this.current = {};
|
||||
|
@ -14,18 +15,22 @@ var WMIObject = function() {
|
|||
this.create = function() {
|
||||
try {
|
||||
if (typeof(GetObject) === "function") {
|
||||
this.interface = GetObject("winmgmts:{impersonationLevel=impersonate}!\\\\" + this.server + "\\root\\cimv2");
|
||||
this.interface = GetObject("winmgmts:{impersonationLevel=impersonate}!\\\\" + this.computer + "\\" + this.namespace);
|
||||
} else {
|
||||
var objLocator = CreateObject("WbemScripting.SWbemLocator");
|
||||
this.interface = objLocator.ConnectServer(this.server, "\\root\\cimv2");
|
||||
this.interface = objLocator.ConnectServer(this.computer, this.namespace);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e.message);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
this.setServer = function(server) {
|
||||
this.server = server;
|
||||
this.setComputer = function(computer) {
|
||||
this.computer = computer;
|
||||
return this;
|
||||
};
|
||||
this.setNamespace = function(namespace) {
|
||||
this.namespace = namespace;
|
||||
return this;
|
||||
};
|
||||
this.execQuery = function(query) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user