using invoke-command how to pass local variable

15 views
Skip to first unread message

deepthi cherukuri

unread,
May 31, 2017, 12:51:51 PM5/31/17
to nodejs
const shell = require('node-powershell');
let ps2 = new shell({
executionPolicy: 'Bypass',
noProfile: true
});
ps2.addCommand('Invoke-Command -ComputerName $machinename -ScriptBlock {node 
path of the script  $args[0]} -ArgumentList $text -
credential $Cred')

tried accessing in the remote node.js script as follows: var arg=$args[0] console.log(""+arg); using invoke-command which is node-powershell command,how to pass local variable to a remote nodejs script and access it in that nodejs script

Reply all
Reply to author
Forward
0 new messages