It looks like commands call Initialize-WinSession and if -ComputerName and -ConfigurationName are not passed to the outer command by the user, The defaults are then used, which initializes or returns the local computer session.
We should adjust the logic in Initialize-WinSession to not clobber the exiting remote session with a local session when the module commands are called without the additional paramters, or Initialize-WinSession should update the $script:DefaultComputerName and $script:DefaultConfigurationName when it initializes a new session.
I was writing up some quick start guides and when I went to validate how remote modules worked I discovered the remoting scenario is broken. Repro:
Expected result:
actual result:
It looks like commands call
Initialize-WinSession
and if-ComputerName
and-ConfigurationName
are not passed to the outer command by the user, The defaults are then used, which initializes or returns the local computer session.We should adjust the logic in
Initialize-WinSession
to not clobber the exiting remote session with a local session when the module commands are called without the additional paramters, or Initialize-WinSession should update the$script:DefaultComputerName
and$script:DefaultConfigurationName
when it initializes a new session.