Debug-Job :The job cannot be debugged because the host debugger mode is set to None or Default
问题 I created a sample powershell project with a Script.ps1 file and a Modules\Script1\Script1.psm1 file. the module file.. # Script1.psm1 function Get-Greeting{ Start-Sleep -Seconds 10 Write-Host "hello from foo"; } and the script file.. # Script1.ps1 if(-not(Get-Module -Name "Script1")){ Import-Module .\Modules\Script1 } if(Get-Module -Name "Script1"){ Remove-Module Script1; Import-Module .\Modules\Script1; } Get-Greeting # output: hello from foo $ajob = Start-Job -ScriptBlock { Get-Greeting }