#PSTip How to get the number of IIS current client connections

Note: This tip requires PowerShell 2.0 or above.

Using the Get-Counter cmdlet and the Web Service Current Connections performance counter, you can get the amount of current connections to an IIS server or to one of its web sites. This counter is extremely useful in load balanced environments where you want to make sure that connections are evenly balanced across a group of IIS servers.

The following command gets the total number of connections for the server:

This example gets the number of connections for a specified website of three front end servers of a SharePoint farm:

About the author: Shay Levy

Shay Levy is a Co-founder and editor of the PowerShell Magazine. He is a multiple-year recipient of the Microsoft MVP award, and a Microsoft Certified Trainer (MCT). Shay often covers PowerShell related topics on his blog and you can also follow him on Twitter at @ShayLevy

Related Posts