Issues with wait-psujob

avatar
Product: PowerShell Universal
Version: 5.6.8


I have the following endpoint which just calls a script.

$Parameters = @{
	Url = "/test"
	Method = @('GET')
	Endpoint = {
		"calling script"

        $CurrentJob = Invoke-PSUScript -Script "Examples/HelloWorld.ps1" -ErrorAction Continue
        $null = Wait-PSUJob -Job $CurrentJob 

        return $CurrentJob
}
New-PSUEndpoint @Parameters


The script contents of helloWorld.ps1

#throw "This is an error message from throw" # This will throw an error and stop the script
#Write-Error "This is an error message from Write-Error"  # This will write an error message to the console
Write-Warning "This is a warning message from Write-Warning" # This will write a warning message to the console
Write-Information "This is an information message from Write-Information" # This will write an information message to the console
Write-Verbose "This is a verbose message from Write-Verbose"
Write-Debug "This is a debug message from Write-Debug"

Write-Error "whoops" -ErrorAction Continue


How come I dont get any of that other output streams? It has something to do with Wait-PSUJob



ff820fb66392e4853fdd0000ab95fdf120a9e86f

ff820fb66392e4853fdd0000ab95fdf120a9e86f.png

All Comments (2)

avatar



d2ceac079b1ff690d4b0a371b47276a7db615ac7
This is the output from the script that got executed with invoke-psuscript

d2ceac079b1ff690d4b0a371b47276a7db615ac7.png

avatar

Dammit, i was working on this for like an hour and after I posted this I found out there is a -silent param you can pass to wait-psujob

$null = Wait-PSUJob -Job $CurrentJob -Silent