Dashboard fails to call script via REST

Product: PowerShell Universal
Version: 2.10.0


we have a dashboard for a customer to modify accounts used for exams. it worked fine about one month ago but now throws an error (see below) when trying to call the actual script via REST.
when I run it manually via REST it works fine, just not from the dashboard.
Any ideas?

One or more errors occurred

No jobID

   at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
   at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
   at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
   at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)
   at UniversalDashboard.Execution.PowerShellExecutionService.ExecuteEndpoint(ExecutionContext context, AbstractEndpoint endpoint, List`1 nonTerminatingErrors) in D:\a\universal\universal\src\UniversalDashboard\Execution\PowerShellExecutionService.cs:line 164

This error message is shown on the dashboard page.


Can you share a snippet of the code you’re using the call it? I did a quick search on the code base and don’t see the error “No jobID” anywhere that we are directly generating.

that is a throw in my script.
the dashboard is putting together the $body variable depending on what the user selects in the dashboard form, like (de)activate accounts, set password, set expiration date etc. $headers is just Content-Type and Bearer token. $puStart is the URL for either staging or prod environment.

$jobID = Invoke-RestMethod -Uri $puStart -Headers $headers -Body $body -Method Post -ContentType 'application/json; charset=utf-8' -UseBasicParsing
Start-Sleep -Seconds 10
if ([string]::IsNullOrEmpty($jobID)) {
  throw [System.Exception]::new('No jobID')

if I run the same command with the exact same parameters manually in a powershell window, it runs fine. it creates a job for the script, which actually modifies the accounts, and returns the job ID.

Edit: I just tested it in stage running 3.0.5. I get the same error. I assume, because it was running fine a month ago, that the last windows patchday has something to do with it. I didn’t touch anything else on the prod system.

I recommend increasing the log level to Debug for the Microsoft settings. This will cause the server to log all HTTP requests. You should see it coming in at least. It should also provide info if it is returning an error status code (doesn’t seem like it).

thank you, the Debug log level helped.
[DBG] No candidates found for the request path '//api/v1/script/path/Set-PU-BulkAccounts.ps1'
when I put together the servername and the script path I had a slash at the end of the servername and one at the begginning of the script path so the URL looked like this “https://PU-FQDN//api/v1/script/path/Set-PU-BulkAccounts.ps1
thanks again for the hint.



1 Like