使用Powershell活跃用户是否在网站中?

时间:2014-06-24 10:56:59

标签: asp.net-mvc powershell

使用Power shell如何让活跃用户在网站中获取数量?

我尝试了以下代码但未获得结果

function Get-WebServiceConnections()
{
  $results = @{}
  $perfmon = new-object System.Diagnostics.PerformanceCounter
  $perfmon.CategoryName = "Web Service"
  $perfmon.CounterName = "Current Connections"

  $cat = new-object System.Diagnostics.PerformanceCounterCategory("Web Service")
  $instances = $cat.GetInstanceNames()

  foreach ($instance in $instances)
  {
    $perfmon.InstanceName = $instance
    $results.Add($instance, $perfmon.NextValue())
  }
  write-output $results
}

(参考 - http://poshcode.org/1146

0 个答案:

没有答案