Forum Discussion
SunPower
Jul 09, 2021Copper Contributor
Invoke-Command ScriptBlock issue
Hi All, am facing some issues when using invoke commamd. Issue1: if I say invoke-command -computername abc -scriptblock{c:\abc\runprocess.cmd -create} This is working fine. But if I put c:\ab...
psophos
Jul 09, 2021Brass Contributor
Does calling it like this work?:
$abcPath = {
c:\abc\runprocess.cmd -create
}
invoke-command -computername abc -scriptblock $abcPath
Note the lack of { } after the -scriptblock parameter.
SunPower
Jul 09, 2021Copper Contributor
Thanks for your reply psophos but issue is not resolved. Still same behavior - basically it's not displaying anything.
- psophosJul 09, 2021Brass ContributorDisplaying or executing?
I would not expect it to display anything as the code is being executed on the remote computer.