Get endpoint name from the winRM session itself

Hi everyone,

I have some hard time to explain what I’m looking for with words so here with code:

When I do a remote session on a specific endpoint:

Enter-PSSession -ComputerName mysrv -Credential $creds -ConfigurationName Jea1

Once connected, do you know a way to get the parameter Jea1 from the session itself? I’ve checked the automatic variables, the session configuration but no luck or I’ve simply missed it.

PS: If you don’t have JEA, you can simulate with:

Enter-PSSession -ComputerName localhost -ConfigurationName ‘microsoft.powershell’

And of course, what I’m looking for is: ‘microsoft.powershell’

Thank you in advance,

François

$PSSenderInfo gives you the same. Its an automatic variable and value will be available in all remote sessions.

thank you for the quick answer. Sadly $PSSenderInfo (this is the first that I’ve tried) is useful to get the connected/runasUser information but nothing regarding the endpoint name. Here what I see on mine:

UserInfo : System.Management.Automation.Remoting.PSPrincipal
ClientTimeZone : System.CurrentSystemTimeZone
ConnectionString : http://myserver:5985/wsman?PSVersion=5.1.18362.145
ApplicationArguments : {PSVersionTable}
ConnectedUser : myUserAccount
RunAsUser : myGMSA

No trace of jea1 sadly.

see whats there in $PSSessionConfigurationName, currently I don’t have another system to test, I get the values when remote into the same machine.

nice try, I’ve missed that one but still no luck. Here the answer even if I’m connected to my JEA endpoint jea1

http://schemas.microsoft.com/powershell/Microsoft.PowerShell

I will continue on my side, I hope I will find the answer.

Cheers

François

Quick update, same status, I can’t find anything in variables, nothing in event log, I don’t see any cmdlets that I can use to extract this info. I think I’m stuck but I really have some hard time to understand that we can’t get this endpoint name once we’re connected on it.

Cheers

This is all you can get…

Enter-PSSession -ComputerName localhost -ConfigurationName 'microsoft.powershell' -Verbose

$PSSenderInfo
$PSSessionConfigurationName
Get-PSSessionConfiguration

$PSSenderInfo | Select-Object -Property '*'
$PSSessionConfigurationName | Select-Object -Property '*'
Get-PSSessionConfiguration | Select-Object -Property '*'

$PSSenderInfo | Get-Member -Force
$PSSessionConfigurationName | Get-Member -Force
Get-PSSessionConfiguration | Get-Member -Force

Exit-PSSession

 

 

Hi guys,

This is a good one. After the last comment, I’ve decided to give it a try on my Windows 10 1903 instead of directly on my 2016 server (machine where I have a bunch of endpoints). So on my wks, I’ve created an constrained endpoint and once connected on it simply run $PSSenderInfo again. What was my surprise when I saw:

UserInfo : System.Management.Automation.Remoting.PSPrincipal
ClientTimeZone : System.CurrentSystemTimeZone
ConnectionString : http://mymachine1:5985/wsman?PSVersion=5.1.18362.145
ApplicationArguments : {PSVersionTable}
ConfigurationName : Jea1
ConnectedUser : myuser
RunAsUser : myuser

As you can see, on my Win10 1903 I have the correct ConfigurationName that I don’t have on my 2016 server … The only difference between the 2 is according to me the $PsVersionTable.

Windows 2016 > 5.1.14393.3053

Windows 1903 > 5.1.18362.145

PS: Please accept my apologies kvprasoon.

Do you know guys how I can update the WMF binaries? My server is fully patched according to windows update. Even after 11 years of Powershell, I never did this kind of upgrade …

Cheers

François

 

You just run the normal patching, and Windows OS updates takes care of that.

You used to have to download and install the .Net and WMF installers to get the latest version of PowerShell. Yet, that has been legacy thing since before Win10 releases. All that is part of the OS now, no separate installs anymore.

PS versions have always been OS version dependent to date. What’s is in / on one is not necessarily available on another.

With the release of PS OSS (v6 and beyond), well, things changed again, but oh well.