如何知道在IIS托管的特定网站使用PowerShell中的活动会话数 [英] How to know the active session counts for a particular website hosted in IIS using PowerShell

查看:142
本文介绍了如何知道在IIS托管的特定网站使用PowerShell中的活动会话数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我问一个问题关于知道正在运行的会话数在IIS。

<一个href=\"http://stackoverflow.com/questions/9734561/get-running-session-count-from-iis-for-my-hosted-asp-net-web-site\">Get从IIS中运行的会话数为我主持Asp.Net网站

和我得到了以下PowerShell脚本

 写主机获取性能计数器...$ perfCounterString =\\ asp.net应用程序(__ __总额)\\会议活动
$反=获取计数器 - 计数器$ perfCounterString
$ rawValue = $ counter.CounterSamples [0] .CookedValue写主机会话数为$ rawValue

RightNow的这个脚本是给活动会话数在IIS托管的所有网站

我只是想知道如何修改这个脚本,这样它应该给活动会话数只对特定网站。


解决方案

  $服务器名称='IIS1
$网站名称=默认网站拿到柜台\\\\ $服务器名称\\ Web服务($站点名)\\当前连接

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.

解决方案

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

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

这篇关于如何知道在IIS托管的特定网站使用PowerShell中的活动会话数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆