Remote sessions targeting PowerShell 7 don't display remote hostname in tab? #3161
-
I have a mix of Windows machines (mostly Windows 10/11, Windows Server 2019/2022). By default, all these machines have PowerShell 5 installed, but on most of them I've also installed PowerShell 7. In NETworkManager, I have been able to easily save connection profiles for connecting to remote hosts using the default PowerShell 5 configuration in this way: And the new remote PowerShell session clearly displays the host name in the tab. This is VERY useful because I might have several PowerShell tabs open to a variety of remote hosts at once. However, I've not be able to replicate the same behavior for PowerShell 7. To be clear, I'm able to establish PowerShell 7 connections using a work-around. It looks like this: pwsh.exe -NoLogo -NoExit -Command "Enter-PSSession -ComputerName {HostName} -ConfigurationName PowerShell.7" Unfortunately, using this workaround creates all PowerShell 7 remote connections with a tab that's generically labeled as "PowerShell". So I might have multiple PowerShell 7 remote connections open, but I can't easily identify them by their tab name. I understand why this is occurring. The connections with Remote Console enabled (default PowerShell 5) allows specifying "Host" field which is then used as the label for the tab. However, when disabling Remote Console (for PowerShell 7 workaround), the Command field can't be relied upon for assigning a host name to the tab. Perhaps I'm missing some other obvious solution, but I can't figure out how to create remote sessions for PowerShell 7 to have the same useful "host name" label appear in the tab. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Please disregard this post. I found the answer. When I was testing this using ad hoc connection, the behavior is as described in the post. However, saving connection info to a profile DOES pass the host name label to the tab whether or not the "Remote Console" enabled button is checked. If I want to connect via PowerShell 5, then i enable Remote Console and save to profile. If I want to connect via PowerShell I disable Remote Console, pass the command as shown above, and save to profile. |
Beta Was this translation helpful? Give feedback.
If you use a profile, it should always use the profile name. When remote connection then the hostname is used.