The Chairman is eagerly looking forward to this year’s PowerShell + DevOps Global Summit. In preparation for the first in-person Iron Scripter challenge in a few years, the Chairman has commissioned this intermediate to advanced PowerShell scripting challenge.
PowerShell Remoting Status
The task is to write a PowerShell function that can query a remote server and report on the status of existing PowerShell remoting connections. The function should accept pipeline input for computer names and support alternate credentials. Since you will likely be using PowerShell remoting to gather remoting information, you should exclude this connection in the report.
The output should show the following information:
- The remote computer name
- The name of the connected user
- When they connected
- How long the connection has been running
- The process ID
If you can also determine if the connection is using WSMan or SSH that would be a great bonus. Another bonus would be to include the user’s IP address and/or computer name.
The Chairman looks forward to reviewing the links to your solutions in the comments.