How to pass Multiple Variables as Arguments to a Script using Start-job.
Start-Job -Name "$jobName" -filepath $TestTool -ArgumentList $compare1
how to retrieve this argument values (of $arg1 and $arg2) in a script TestTool.ps1?
Rgds Naveen
PS>Start-Job -Name test -ArgumentList @("hello","word") -FilePath \\server\share\test.ps1
in test.ps1 just echo the $args var
$args
result :
PS>Receive-Job test -keep
hello
word
http://technet.microsoft.com/en-us/library/hh849698.aspx
"Because all of the values that follow the ArgumentList parameter name are interpreted as being values of ArgumentList, the ArgumentList parameter should be the last parameter in the command."
So I guess tha something like:
... -ArgumentList $arg1 $arg2
should work?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With