Exchange Server | Murat Bilici

"Empower your knowledge"

Determine the Number of Active Users on Exchange 2010 Client Access Servers with PowerShell

Looking for a quick way to see how many users are currently connected to each of your Client Access Servers? This might be useful if you want to get a rough idea on load distribution, or when you’re getting ready to drain stop a server in a CAS array prior to maintenance. It’s always good to know how many users might be affected by an taking a server down. The following PowerShell function will grab performance counter data from each server to determine the number of active OWA and RPC connections:

function Get-CASActiveUsers {

[CmdletBinding()]

param(

[Parameter(Position=0, ParameterSetName="Value", Mandatory=$true)]

[String[]]$ComputerName,

[Parameter(Position=0, ParameterSetName="Pipeline", ValueFromPipelineByPropertyName=$true, Mandatory=$true)]

[String]$Name

)

 

process {

switch($PsCmdlet.ParameterSetName) {

“Value” {$servers = $ComputerName}

“Pipeline” {$servers = $Name}

}

$servers | %{

$RPC = Get-Counter “\MSExchange RpcClientAccess\User Count” -ComputerName $_

$OWA = Get-Counter “\MSExchange OWA\Current Unique Users” -ComputerName $_

New-Object PSObject -Property @{

Server = $_

“RPC Client Access” = $RPC.CounterSamples[0].CookedValue

“Outlook Web App” = $OWA.CounterSamples[0].CookedValue

}

}

}

}

 

Get-CASActiveUsers -ComputerName cas1,cas2

 

Categories: Exchange 2010 - Powershell - Tip&Tricks