Product: PowerShell Universal
Version: 5.0.11
I have a app page that needs to call a command in a pssession on a remote computer.
Basically it works, but sometimes it takes over a minute to reconnect to an existing session.
I tried several different approaches and combinations…
This is what I use now:
I store the session information in a $page: scope variable.
When the app page is opened, I check for the content of the variable.
If no, I will create an empty one and call New-PSsession and store the session info in the variable.
If yes, I try Connect-PSsession, and then Invoke-Command -session…
Again, this works foremost.
Consecutive calls on the app page run without issues and fast.
But if I leave the app page idle for a few minutes (way less than the app page timeout of 25mins, and way less then the configured session timeouts),
the reconnect takes very long…over a minute.
Both servers have a good network connection, enough ram and cpu at a high %.
Would anybody know any trick to get that resolved or the session reconnect sped up?
Thanks
Michael