Working with API calling Scripts

Product: PowerShell Universal
Version: 2.10.2

Hi !

I’m willing to call a script (automation tab) from an API but it’s pretty slow. I having a pretty simple powershell script that is called from an API endpoint, the script itself executed with powershell run pretty fast, but as soon as I configure the API endpoint to call the script it take something like 4-5 seconds to get an output.

I’ve tried with persistant runspaces / high perf runspace etc and nothing change much in term of performance :frowning:

The API endpoint is configured as follow :

 Invoke-PSUScript -Name 'Get-Machine.ps1' -machine_name $name -Integrated | Tee-Object -Variable Job | Wait-PSUJob -Integrated
    Get-PSUJobPipelineOutput -Job $job -Integrated | ConvertTo-Json -Depth 10 -AsArray

and the script is simply a get-ADcomputer with the machine name.

Any Idea how it would be possible to get it executed faster ?

PSU Runs as a Windows Service and nothing has been done to tune it in any way

Many thanks in advance !