PowerShell Function to Determine PSSessions to your Servers

This past week, I needed to determine if anyone had a PSSession connected to any of the servers that I support. This is fairly easy to accomplish with a PowerShell one-liner, but I can never remember the syntax so I decided to create a reusable function to accomplish the task.

The function accepts multiple computer names via parameter input:

It also accepts the computer names via pipeline input and it has a Credential parameter so that alternate credentials can be specified:

The Get-MrRemotePSSession function shown in this blog article can be downloaded from my PowerShell repository on GitHub.

µ

1 Comment

  1. Tim Bolton

    Those CIM Sessions are still hidden Sneaky little buggers… : ) Nice write up Mike!!!

    Reply

Leave a Reply

%d bloggers like this: