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!!!


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: