如何使用PowerShell了解IIS中托管的特定网站的活动会话计数

Imr*_*zvi 4 asp.net iis powershell powershell-2.0 windows-server-2008

我问了一个关于知道IIS中运行会话数的问题.

从我托管的Asp.Net网站获取IIS的运行会话数

我得到了以下的powershell脚本

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
Run Code Online (Sandbox Code Playgroud)

此单击此脚本为IIS中托管的所有网站提供活动会话计数

我只想知道如何修改此脚本,以便它只应为特定网站提供活动会话计数.

Sha*_*evy 9

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

get-counter "\\$ServerName\web service($SiteName)\current connections"
Run Code Online (Sandbox Code Playgroud)