Skip to content

Instantly share code, notes, and snippets.

@mendel129
Last active December 24, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mendel129/6809737 to your computer and use it in GitHub Desktop.
Save mendel129/6809737 to your computer and use it in GitHub Desktop.
get all connected exchange users from client access servers
$RPC =Get-Counter "\MSExchange RpcClientAccess\User Count" -computername "srv1"
$OWA =Get-Counter "\MSExchange OWA\Current Unique Users" -computername "srv1"
$POP = Get-Counter "\MSExchangePop3(1)\Connections Current" -ComputerName "srv1"
$IMAP = get-counter "\MSExchangeImap4(1)\Current Connections" -ComputerName "srv1"
$csa=New-Object PSObject -Property @{
Server = srv1"
"rpc" = $RPC.CounterSamples[0].CookedValue
"owa" = $OWA.CounterSamples[0].CookedValue
"pop" = $POP.CounterSamples[0].CookedValue
"imap" = $IMAP.CounterSamples[0].CookedValue
}
$RPC =Get-Counter "\MSExchange RpcClientAccess\User Count" -computername "srv2"
$OWA =Get-Counter "\MSExchange OWA\Current Unique Users" -computername "srv2"
$POP = Get-Counter "\MSExchangePop3(1)\Connections Current" -ComputerName "srv2"
$IMAP = get-counter "\MSExchangeImap4(1)\Current Connections" -ComputerName "srv2"
$csb=New-Object PSObject -Property @{
Server = "srv2"
"rpc" = $RPC.CounterSamples[0].CookedValue
"owa" = $OWA.CounterSamples[0].CookedValue
"pop" = $POP.CounterSamples[0].CookedValue
"imap" = $IMAP.CounterSamples[0].CookedValue
}
write-host $csa.server", pop:" $csa.pop ", imap" $csa.imap ", owa: " $csa.owa, "rpc: " $csa.rpc
write-host $csb.server", pop:" $csb.pop ", imap" $csb.imap ", owa: " $csb.owa, "rpc: " $csb.rpc
Read-Host "exit"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment