Write Review

The information about the number of active user sessions is vital for determining and expecting the server load. It also helps you to determine the perfect time for maintaining the server. In addition, you can choose the right time for making the website update.

You can see the number of active user sessions on the IIS site by using the Performance Monitor tool for your Windows hosting. You just need to set a number of counters. There is another way of doing it with the PowerShell. You will find all the details in this article.

Seeing the Number of Active User Sessions on IIS Site with the Performance Monitor Tool

  1. Press Windows + R button. Type perfmon and hit the Enter button.
  2. Now, you have to add the relevant counters for seeing the number of active user sessions. To do it, click on the green “+” button on the toolbar.
  3. Find the Web Service group. Expand it. You will see a list of available counters. For this tutorial, we will be utilizing the following ones:
  • Current Anonymous Users
  • Current Non-Anonymous Users
  • Current Connections
  1. Choose your desired counter. Select your IIS website in the field of Instances of selected objects. Click on the Add>> button. The counter will be added instantly.

How to View the Number of Active User Sessions on IIS site

  1. Do the same thing for all the required counters. Click on the OK button.
  2. Now, you will see a variety of real-time information related to the active user sessions in the Performance Manager console. You will see the counters that you had added in the bottom pane.

How to View the Number of Active User Sessions on IIS site

The Performance Monitor tool allows you to add your custom counters to the console. You can save them in a different view for later usage.

Seeing the Number of Active User Sessions on IIS Site with PowerShell

  1. Open PowerShell.
  2. Insert the following command:
(Get-Counter -ListSet 'Web Service').counter
  1. To know the number of active sessions on your website (Site1), write this line:
Get-Counter "web service(Site1)current connections" -ComputerName web-srv01
  1. If you want to check the number of connections on your website locally, use this command:
Get-Counter "web service(Site1)current connections" -ComputerName $env:COMPUTERNAME

Here, you are using the environment variable COMPUTERNAME, as specifying the localhost is not allowed.

  1. If you want to know the current connections on the entire IIS server, type this line:
((Get-Counter -Counter 'web service(_total)current connections' -computer $env:COMPUTERNAME) | Select-Object -Expand countersamples).Cookedvalue

Conclusion

In this article, you have learnt to see the number of active user sessions on your IIS site using the Performance Monitor tool and PowerShell. Now, you can easily analyze the data and take important decisions about maintaining the website at the right time.

Check out these top 3 Windows hosting services:

Was this article helpful?