Socket
Book a DemoInstallSign in
Socket

node-powershell

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-powershell

Lightweight module to run PowerShell straight from your Node app

Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Node-PowerShell

Lightweight module to run PowerShell straight from your Node app

Version npmNPM DownloadsDependencies

Installation

$ npm install node-powershell

Quick start

var shell = require('node-powershell');

PS = new shell('echo "node-powershell is awesome"');

PS.on('output', function(data){
    console.log(data);
});
PS.on('end', function(code) {
    //optional callback
    //Do Something
});

Examples

Running a .ps1 script:

PS = new shell("Path/To/Your/Script.ps1");

Putting an input to yor script:

Just use param ( ) instead of Read-Host in your script:

param (
    [Parameter(Mandatory = $true)]
    [string]$st
)
echo $st

and 'path "args"' in your node app:

PS = new shell('Path/To/Your/Script.ps1 "node-powershell Rocks"');

Disabling Debug Messages:

use {debugMsg: false} option: (Default is true)

PS = new shell('echo "node-powershell is awesome"', {debugMsg: false});

License

MIT

Keywords

node-powershell

FAQs

Package last updated on 25 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts