Powershell JEA Just Enough Administration Session client IP

To get the IP from inside a session you can use Get-WSManInstance. If you run the endpoint as a group managed service account it has to be administrator on the local machine. Otherwise you will get access denied. The variable $PID exist inside the JEA Session.

Function Get-IP
    Get-WSManInstance -ConnectionURI http://localhost:5985/wsman -ResourceURI shell -Enumerate | Where { $_.ProcessId -eq $PID }

This entry was posted in Powershell and tagged , . Bookmark the permalink.