I've been working with JEA (Jest Enough Administration) in PowerShell recently and would like the JEA sessions to only use a specific non-standard TCP-port.
I'm able to configure the WinRM service to listen on multiple ports using
winrm s winrm/config/client '@{HTTPS="5986, 7799"}'
winrm enumerate winrm/config/listener
But I can't find out how to register a SessionConfiguration to bind to only one of the available WinRM-ports.
When I list the properties of a SessionConfiguration, there is no properties for what port or listener to use.
Get-PSSessionConfiguration | select * -First 1
I'm only able to specify what port to use when entering the session from the client side using
Enter-PsSession <host> -ConfigurationName <MyJEAName> -Port <any available WinRM Port>
So, I could in practice connect to any other session I've have permission to as well, even if I only allow the new WinRM custom port trough my firewall.
Is there a way to control what PowerShell SessionConfiguration to connect to based on TCP-port?