How to know the active session counts for a particular website hosted in IIS using PowerShell

◇◆丶佛笑我妖孽 提交于 2020-01-02 05:46:24

问题


I asked a question about knowing the running session count in IIS.

Get running session count from IIS for my hosted Asp.Net web site

and I got the following powershell script

Write-host Getting performance counters ...

$perfCounterString = "\asp.net applications(__total__)\sessions active" 
$counter = get-counter -counter $perfCounterString 
$rawValue = $counter.CounterSamples[0].CookedValue 

write-host Session Count is $rawValue

Rightnow this script is giving active session count for all websites hosted in IIS

I just wanted to know how to modify this script so that it should give active session count only for a particular website.


回答1:


$ServerName = 'IIs1'
$SiteName = 'default web site'

get-counter "\\$ServerName\web service($SiteName)\current connections"


来源:https://stackoverflow.com/questions/9920281/how-to-know-the-active-session-counts-for-a-particular-website-hosted-in-iis-usi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!