I finally joined the community
So for my first question in this community:
Generally I want to execute some remote operations to a remote windows machine in node.js (of course I have permissions, credential and so on to the remote machine).
Specifically, right now I'm trying to retrieve list of services from windows machine. I've tried using the wmi-client package in order to do so:
const WmiClient = require('wmi-client');
var wmi = new WmiClient({
username: '*****', //credentials - username
password: '*****', //credentials - password
host: '*********', // remote windows machine
});
wmi.query(`Select * from Win32_Service`, function (err, result) {
console.log(result);
});
but I keep receiving error: Exit code: 44125. Invalid Global Switch.
I'll mention that using wmi in powershell make no issues for me. but when I trying to use the same technology in nodejs its failed. what am I doing wrong? Any other suggestions?
just to mention, when I need to retrieve same info from linux machine I easiliy do it using 'simple-ssh' package, without any issues:
const SSH = require('simple-ssh');
var ssh = new SSH({
host: '*******', // remote linux machine
user: '*******', // credentials - username
pass: '*******' // credentials - password
});
ssh.exec(`systemctl list-units --full -all`, {
out: function(stdout) {
// stdout as expected
}
}).start()});
but things getting complicated when trying to do the same for windows remote machine.
any ideas? Thank you very much!