I have a custom PowerShell commandlet that I have created in C# that spins up some instances of vstest.console.exe and publishes the test results to a .trx file or to tfs. This commandlet works in isolation when using PowerShell locally.
However when I run the commandlet remotely using v3 PowerShell remoting, The invoke-command completes, but there are 2 issues:
- The test run process does not complete as there is no results file published
- I do not get the results on the remote console, whereas in the local case they bubble up from the newly started processes
Here is the remote call I used in the remote PowerShell calling script
$j = Invoke-Command -Session $currentPSSession -AsJob -ScriptBlock {
Add-PSSnapin "IntegrationTestTools"
Start-IntegrationTests -someotherUnimportantArgs
} | Wait-Job
$results = $j | Receive-Job
from stepping through the script it does indeed wait for the job, however the results are empty.
To note I have setup the remoting as per Keith Hill's post . Also I have setup Wsman with
set-item WSMan:\localhost\Shell\MaxMemoryPerShellMB 0
set-item WSMan:\localhost\Shell\MaxProcessesPerShell 0
set-item WSMan:\localhost\Shell\MaxShellsPerUser 0
So processes and allowed memory should not be limiting this particular exercise.
Any ideas?