Using Start-Job and ArgumentList, how do you pass an array and another variable to the receiving script?
This works if I only need to pass a single array
Start-Job -FilePath "c:\thescript.ps1" -ArgumentList (,$newArray)
Tried this, but the second value is not being used in the receiving script.
Start-Job -FilePath "c:\thescript.ps1" -ArgumentList (,$newArray,"x")
thescript.ps1 example:
param (
[string[]]$aMyArray,
[string]$sMyString
)
function DoWork ([string]$aItem,[string]$sMyString)
{
#worker
}
foreach($aItem in $aMyArray)
{
DoWork $aItem $sMyString
}
I'm currently working in PowerShell 2.0