Clear all $Session: variables?

You can certainly do that as well. The variables are just a concurrent dictionary. You’d have to reference the session and then remove the variable. $SessionId is an automatic variable that will be in the runspace that you can reference to get the current session ID.

$UDEndpointService.SessionManager.Sessions[$SessionId].SessionVariables.Clear()
1 Like