I'm having a hard time understanding persistent connections in PowerShell during remoting sessions. I created my persistent connection and created a variable to test its lifespan:
$session = new-pssession server1
enter-pssession -session $session
$myvar = "abc"
Now I close the shell window to simulate a failure on my computer or reboot. I open up a new shell and try to get the connection from server1
with:
get-pssession server1
It comes up empty. How am I supposed to get back into my previous session?
Supposedly persistent connections are meant to withstand a disconnect or failure and should be available from your computer or even another computer but I can't make it work. What am I doing wrong?