The script would check All Exchange CAS Server in the organization for number of Client connections (OWA,ActiveSync,RPC(outlook),EWS)  and send details as HTML formatted email report. The report is very useful when you want to check the load on the CAS server.

 

The email report would be like 

 

change value for the email report in the script section

 

PowerShell
Edit|Remove
#region Emailsetup 
 
[string] $smtpServer = "smtp.domain.com" 
 
[string] $fromAddress="sender@domain.com" 
 
[string[]] $toAddress="admin@domain.com" 
 
$subject = "CAS Connections Report" 
 
$Date = Get-Date -format f 
 
#endregion Emailsetup
 After successful script execution the report will be generated and copy will be available in the log path.
PowerShell
Edit|Remove
#region Logdirectorysetup 
 
$workingdir = "C:\temp\" 
 
if ( (Test-Path ($workingdir + "\Logs")) -eq $false ) { New-Item -Path ($workingdir + "\Logs") -ItemType Directory } 
 
if ( (Test-Path ($workingdir + "\Logs")) -eq $false ) { Write-Host "Cannot create log directory. Exiting."; exit } 
 
$logfile = "$workingdir\logs\CASCONNECTION.html" 
 
#endregion Logdirectorysetup