PoshRSJob icon indicating copy to clipboard operation
PoshRSJob copied to clipboard

Invoke-Command -ArgumentList errors out when passing hashtable

Open ravinrao opened this issue 8 years ago • 1 comments

I am using CentOS7.3, Installed PowerShell, OMI, PSRP.

When I pass a string as an argument to Invoke-Command -ArgumentList, it goes thru and the script is executed.

When I pass a hashtable to the same, it errors out.

Invoke-Command $s -FilePath /samba/anonymous/TestJSON.ps1 -ArgumentList $jsonContents

Starting a command on the remote server failed with the following error message : MI_RESULT_FAILED For more information, see the about_Remote_Troubleshooting Help topic. + CategoryInfo : OperationStopped: (xxx.xxx.xxx.xxx:String) [], PSRemotingTransportException + FullyQualifiedErrorId : JobFailure + PSComputerName : xxx.xxx.xxx.xxx

$jsonContents is a hashtable containing filename as key and file contents(text) as value. If i replace $jsonContents with a string variable, the script is executed.

Any help would be greatly appreciated.

Thank you Ravi

ravinrao avatar Jul 18 '17 03:07 ravinrao

This doesn't sound like a question for PoshRSJob, but something that might be better handled over at https://github.com/PowerShell/PowerShell/issues

proxb avatar Jul 31 '17 22:07 proxb