Last active
November 30, 2017 18:35
-
-
Save bobfrankly/9e7e9ec33e40fc6a674cae5f7cdc080f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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