Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-55596

PowerShell Plugin | Start-Job command creates TerminatingError(Import-Module)


      I want to execute a Job in Background and grab the test results after each test.

      If I execute the script from the powershell console, everything works as it should, but if I execute the same script from Jenkins, I don't receive anything. The only output I see is:


      PS>TerminatingError(Import-Module): "The Windows PowerShell-Workflow won't be supported in an x86-based Windows PowerShell-Console. Open a x64-based Windows PowerShell-Console and try again."


      PS>TerminatingError(Import-Module): "Der Windows PowerShell-Workflow wird in einer x86-basierten Windows PowerShell-Konsole nicht unterstützt. Öffnen Sie eine x64-basierte Windows PowerShell-Konsole, und versuchen Sie es erneut."

      The Jenkins function is as follows and will be executed for each unit test:
      The problematic code section is :

      $testJob = Start-Job {param($url, $timeout) Invoke-WebRequest $url -TimeoutSec 30 -Method Get} -Arg $urlTest, $script:testTimeout


      function InvokeTest ($hostName, $test) {
          try {
              $urlTest = "http://$hostName/WsTest/$test"
              $testJob = Start-Job {param($url, $timeout) Invoke-WebRequest $url -TimeoutSec 30 -Method Get} -Arg $urlTest, $script:testTimeout
              while (1) {
                  Start-Sleep -Seconds 2
                  if ($testJob.State -eq "Failed") {
                      $testExeStatus = "Test run aborted"
                      $ErrorMessage = $testJob.ChildJobs[0].JobStateInfo.Reason.Message
                  elseif ($testJob.State -eq "Completed") {
                      $testExeStatus = "Test run completed"
                      $testStatus = Receive-Job -Job $testJob
                      $testResult += $testStatus.Content
          catch {
              $testExeStatus = "Test run aborted"
              $ErrorMessage = $_.Exception.Message
          finally {

            Unassigned Unassigned
            sdm_jenkinsuser Hans Redl
            0 Vote for this issue
            2 Start watching this issue