forked from mikepfeiffer/PowerShell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGet-CASActiveUsers.ps1
More file actions
25 lines (24 loc) · 824 Bytes
/
Get-CASActiveUsers.ps1
File metadata and controls
25 lines (24 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
}
}
}
}