PowerShell: Identify the number of users connected to a Exchange 2010 CAS Server

Exchange PowerShell

As part of a Microsoft Exchange 2010 migration, we are moving users from one CAS (Client Access Server) that is being retired to another which is replacing it.

In an ideal world we would have implemented a CAS array, but time and other factors have prevented us from setting this up straight away so we are moving users from one CAS server to another.

So we can see how our progress is going, and so we can confirm there are no users on the old CAS server before we decomission it, it would be useful to query the CAS servers to see how many connections are being made to them.

There isn’t an actual PowerShell command to do this, but we are able to use the Get-Counter command to query a couple of Exchange Performance Monitor counters.

I saved the two lines below in a PowerShell script called get-casconnections.ps1.

Get-Counter “MSExchange RpcClientAccessUser Count” -ComputerName casserver1, casserver2 | ft
Get-Counter “MSExchange OWACurrent Unique Users” -ComputerName casserver1, casserver2 |ft

To be able to run it you may need to modify the Execution Policy, by default it is set to restricted and therefore won’t run scripts you have created.


Get-ExecutionPolicyAs you can see I’ve already changed my Execution Policy to Remote Signed, which will allow me to run local scripts but remote scripts (from the network/Internet) must be signed.

To change your execution policy run the command:

Set-ExecutionPolicy RemoteSigned

Now onto running the Get-CASconnections.ps1 command.

Get-CASconnectionsAs you can see at 10.20pm there aren’t many people connected to either CAS server, but there is still one connected to the original CAS server.

Now if only I can create a script to identify the CAS connections to user accounts….

Related Posts:

1. PowerShell: Identifying ActiveSync Devices with Get-ActiveSyncDevice for Exchange 2010

2. PowerShell: Get-ADUser to retrieve logon scripts and home directories – Part 1

3. Exchange PowerShell: How to list all SMTP email addresses in Exchange

4. Exchange PowerShell: How to find users hidden from the Global Address List

5. Exchange PowerShell: How to enumerate and modify Distribution Group properties

2 thoughts on “PowerShell: Identify the number of users connected to a Exchange 2010 CAS Server

  1. Евгений

    Правильно вот так писать : Get-Counter “\MSExchange OWA\Current Unique Users” -ComputerName Exchcas1, Exchcas2 | ft

Comments are closed.