Skip to content

Instantly share code, notes, and snippets.

@bobfrankly
Last active November 30, 2017 18:35
Show Gist options
  • Save bobfrankly/9e7e9ec33e40fc6a674cae5f7cdc080f to your computer and use it in GitHub Desktop.
Save bobfrankly/9e7e9ec33e40fc6a674cae5f7cdc080f to your computer and use it in GitHub Desktop.
const shell = require('node-powershell');
let ps = new shell({
executionPolicy: 'Bypass',
noProfile: true
});
function psPing(thisIP) {
ps.addCommand('Test-Connection -quiet -count 1 ' + thisIP)
ps.invoke()
.then(output => {
console.log(output);
return output;
})
.catch(err => {
console.log(err);
ps.dispose();
});
}
// I would like to be able to do this:
console.log(psPing("192.168.0.1"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment