I’ve been playing around with New-PSSession for several computerNames and setting them up in a variable ($DCs)
I can retrieve those Sessions fine with Get-Sessions and then, wanted to remove those sessions altogether (close and then free up the variable) so I used Remove-PSSessions $DCs. It seemed to work.
But when I repeat the New-PSSession for the same variable, I get a whole new set of session IDs (incremented sequentially)
So, then I thought I would just clear and/or remove the variable $DCs altogether and that doesn’t seem to work. I get no error with with either clear-variable $DCs or remove-variable $DCs yet, $DCs persists within my PS ISE admin console.
- I wish to generate new PS-Sessions using the same earlier session IDs (helps me understand PSSession)
- I wish to understand why I can’t get rid of a manually defined variable name that persists (get-variable $DCs) without closing the shell.