1
Invoke-Command -ComputerName Server01 -ScriptBlock {
param ($first)

Write-Output "The value of `$a is: $first"
} -ArgumentList $a

The value of $a is: @('1','2','3')

Hi guys, how can i pass $a as an array in remote session ????.

2
  • I'm not the down voter.. Commented Mar 7, 2014 at 15:00
  • Thanks @CB. i can't understand why people down vote even if one has a genuine query. i guess stackexchange admins should have a look at this. Commented Mar 7, 2014 at 17:33

1 Answer 1

2

One way:

Invoke-command -ScriptBlock {param($first) Write-output $first} -argumentlist @(,(1,2,3))

1
2
3
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.