Runspace - Startup Script - Persistance

Product: PowerShell Universal
Version: 3.1.2
Docker image from Hub

Hi there,

Can we use platform variables in them ? I made some tests and it seems like it’s not working properly (to connect on remote systems like vSphere using powerCLI)

Regarding persistance, I noticed that persistance works with API and not with Automation, am I doing something wrong ? I’m using the same Environment for running both API and Script and I noticed, by monitoring processes running in the container, that Automation script start an instance and close it as soon as the script is completed. I a situation where you gotta log on remote servers, it takes ages to run script while it’s faster with API as the environment seems correctly persisting as it does not restart an environment and reconnect on every call.

Using the same script:

  • API it takes 8 seconds first run and less than 1 second on second run.
  • Automation it takes 8 seconds every run.

I’d like to make API script less beefy and call scripts instead but it seems that this strategy ain’t working as expected yet.

Does anyone else than me experienced such behavior ?

Many thanks in advance for your feedback on this !

Cheers !

bump !

Variables currently don’t work in startup scripts.

As for the delay in jobs, this is due to the fact that jobs create a short-lived runspace pool so persistent runspaces don’t have any effect on them. When starting a job in a non-integrated environment, it will create a new process and terminate it once it’s complete. When starting a job in the integrated environment, it will create the runspace pool and then dispose of it after it’s run the job.

We may be able to implement peristence in the integrated environment for jobs but not with external environments.