Since you are working with a workflow session, you will want to put your commands in a workflow.
$session = New-PSWorkflowSession -ThrottleLimit 3
Invoke-Command $session {
workflow test {
Write-Output -Input "test"
}
test
}
For more info, check out PowerShell Workflows: Restrictions and High Level Architecture of Windows PowerShell Workflow (Part 1)