Wednesday, December 4, 2013

scripts to find how many users are logon using OWA

Method 1: 
You can find the output when you run get-logonstatistics from the article below:
View Logon Statistics


Method 2:
Besides, you can use logparser to analyze it
C:\Program Files (x86)\Log Parser 2.2\logparser.exe" "SELECT TOP 10 cs-username, Count(*) AS OWAHits INTO OWAActivity.gif FROM C:\Inetpub\logs\LogFiles\W3SVC1\u_ex*.log WHERE cs-uri-stem LIKE '/OWA/' AND cs-username IS NOT NULL GROUP BY cs-username ORDER BY OWAHits DESC" -charttype:Bar3D -o:CHART -view:ON
Or:
"C:\Program Files (x86)\Log Parser 2.2\logparser.exe" "SELECT TO_STRING(time, 'HH') AS Hour, COUNT(*) AS Hits INTO hitPerSecond.jpg FROM C:\Inetpub\logs\LogFiles\W3SVC1\u_ex*.logGROUP BY Hour ORDER BY Hour ASC" -i:IISW3C -o:CHART -chartType:ColumnClustered -chartTitle:"Hourly Hits" -groupSize:420x280

Method 3:
We can run the command below to get the current number of outlook or OWA user who is connecting to Exchange Servers.
Get-Counter "\MSExchange RpcClientAccess\User Count" -ComputerName  name|ft
Get-Counter "\MSExchange OWA\Current Unique Users" -ComputerName  name |ft


OWA session with name of the user
=======================
Get-Mailbox | Get-LogonStatistics | Where-Object {$_.ApplicationID -eq "Client=OWA"| Select-Object UserName,LastAccessTime | ConvertTo-Html -Title "OWA actives sessions" -PostContent "<b>Thierry MILLE (c) 2011</b>" | Out-File C:\owa.htm; Send-MailMessage -From sender@domain.com -To recipient@domain.com -Subject "OWA sessions" -Attachments C:\owa.htm -SmtpServer 127.0.0.1; Remove-Item C:\owa.htm

No comments:

Post a Comment