I think I solved it by parsing the array that is passed to the job
$code = {
param (
[array]$arrServer,
[array]$arrSessionId
)
Set-PowerCLIConfiguration -DisplayDeprecationWarnings $false -Confirm:$false | Out-Null
$intCount = 0
foreach ($strServer in $arrServer)
{
Connect-VIServer -Server $strServer -Session $arrSessionId[$intCount] | Out-Null
$intCount++
}
(Get-VM).Count
}
$sJOb = @{
ScriptBlock = $code
ArgumentList = $global:DefaultVIServers.Name, $global:DefaultVIServers.SessionId
}
Start-Job @sJOb
Seems messy and not reliable since the SessionID may or may not be in the right order. Although, the way it is, it does work for either single entries or multiple entries. I'm just not 100% that the SessionID will always be in the same order as the vCenter servers list so they match up.