Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


June 23, 2009

Q. How can I see a list of all users who access Exchange via the Outlook Web Access (OWA)?

RSS
Subscribe to Windows IT Pro | See More Outlook Web Access (OWA) Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

A. If you inspect the IIS web service logs you'll will see all the access logs, which include source IP address and username. This file is very cumbersome, however. A friend of mine, Tim McCarty, used the LOGPARSER tool with a little T-SQL script to take the data and reformat into a more digestible format. To make sure logs are enabled check, the Web Site tab of the default web site, as shown here.

Click to expand.

First, save the following as UsersofOWA.sql

Select

date as [Date],
time as [Time],
s-ip as [Server IP],
cs-username as [UserName],
c-ip as [Client-IP],
cs-method as [Request Verb],
cs-uri-stem as [Request URI]

FROM \\<UNC-PATH-TO-THE-LOGS\*.log 

WHERE cs-method LIKE 'GET' AND cs-uri-stem LIKE '/exchange'
AND cs-username LIKE'%'

(The FROM line could also be a local or mapped drive.)

Once you've saved this, you can parse the file using the command

LOGPARSER -i:IISW3C file:D:\Sources\logs
\UsersofOWA.sql -o:csv -q:off >D:\sources\logs
\OWALogins.csv

Once you have the CSV file, you can see information such as unique users using Microsoft Excel's remove duplicates functionality. You can also tune the above commands and formats to get the format you want.

Below is an example of the source log file format.

date time s-ip cs-method cs-uri-stem cs-username cs-uri-query
s-port c-ip cs(User-Agent) sc-status sc-substatus
sc-win32-status
5/31/2009 0:00:00 10.10.10.10 POST /exchweb/bin/auth/owaauth.dll
- - 443 <public-ip>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.0) 302 0 0
5/31/2009 0:00:00 10.10.10.10 PROPFIND /exchange/username1/
username1 - 443 <public-ip>
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.0) 207 0 0
5/31/2009 0:00:00 10.10.10.10 PROPFIND /exchange/username1/
username1 - 443 <public-ip>
Mozilla/4.0+(compatible;+MSIE+5.5;+Windows+NT+5.0) 207 0 0
5/31/2009 0:00:00 10.10.10.10 SEARCH /exchange/username1/Inbox
username1 - 443 <public-ip>
Mozilla/4.0+(compatible;+MSIE+5.5;+Windows+NT+5.0) 207 0 0
5/31/2009 0:00:00 10.10.10.10 SEARCH /exchange/username1/Inbox
username1 - 443 <public-ip>
Mozilla/4.0+(compatible;+MSIE+5.5;+Windows+NT+5.0) 207 0 0
5/31/2009 0:00:00 10.10.10.10 POLL /exchange/username2/Inbox
- - 443 <public-ip>
Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;
+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+.NET+CLR+3.0.04506.30;
+.NET+CLR+3.0.04506.648;+.NET+CLR+3.5.21022) 401 2 2148074254
5/31/2009 0:00:03 10.10.10.10 POST /Microsoft-Server-ActiveSync
domainname\username3 User=username3
&DeviceId=<device-id>.&DeviceType=iPhone&Cmd=Ping&Log=
V4TNASNC:0A0C0D0FS:0A0C0D0SP:1C20I11176S161712R0S0L300H0P 
443 <public-ip> Apple-iPhone/508.11 200 0 0
5/31/2009 0:00:04 10.10.10.10 POST /Microsoft-Server-ActiveSync
domainname\username5 User=username5
&DeviceId=<device-id>&DeviceType=SmartPhone&Cmd=Ping&Log=
V4TNASNC:0A0C0D0FS:0A0C0D0SP:1C17I8718S68530R0S0L1680H0P 443
 <public-ip> MSFT-SPhone/5.2.402 200 0 0
5/31/2009 0:00:04 10.10.10.10 POLL /exchange/username6/Inbox
 - - 443 <public-ip> 
Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;
+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+.NET+CLR+3.0.04506.30;+
.NET+CLR+3.0.04506.648;+.NET+CLR+3.5.21022) 401 2 2148074254
5/31/2009 0:00:04 10.10.10.10 POST /Microsoft-Server-ActiveSync
 domainname\username7 User=username7
&DeviceId=<device-id>&DeviceType=iPhone&Cmd=Sync&Log=
V4TCoSSC:0A0C0D0FS:0A0C0D0SP:1C3I5426S49100R0S0L0H0P 443 
<public-ip> Apple-iPhone/508.11 200 0 0
5/31/2009 0:00:06 10.10.10.10 GET /exchange/username8/
username8@domainname.com cmd=spellcheck 443 <public-ip> 
Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;
+.NET+CLR+2.0.50727;+.NET+CLR+1.1.4322;+.NET+CLR+3.0.04506.30;+
.NET+CLR+3.0.04506.648;+.NET+CLR+3.5.21022) 200 0 0
5/31/2009 0:00:06 10.10.10.10 GET /exchweb/6.5.7651.60/
controls/style30.css - - 443 <public-ip> 
Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;
+.NET+CLR+2.0.50727;+.NET+CLR+1.1.4322;+.NET+CLR+3.0.04506.30;+
.NET+CLR+3.0.04506.648;+.NET+CLR+3.5.21022) 200 0 0
5/31/2009 0:00:06 10.10.10.10 GET /exchweb/themes/0/
owacolors.css - - 443 <public-ip> 
Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;
+.NET+CLR+2.0.50727;+.NET+CLR+1.1.4322;+.NET+CLR+3.0.04506.30;+
.NET+CLR+3.0.04506.648;+.NET+CLR+3.5.21022) 200 0 0
5/31/2009 0:00:06 10.10.10.10 POST /Microsoft-Server-ActiveSync
domainname\username9 User=username9
&DeviceId=<device-id>&DeviceType=SmartPhone&Cmd=Sync&Log=
V4TEmSSC:0A0C0D0FS:0A0C0D3SP:1C4I16442S35772R0S0L0H0P 
443 <public-ip> MSFT-SPhone/5.2.402 200 0 0
5/31/2009 0:00:06 10.10.10.10 GET /exchange/username8/
username8@domainname.com cmd=script&template=
loc_spellcheck&cache=1&ver=6.5.7651.60 443 <public-ip> 
Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;
+.NET+CLR+2.0.50727;+.NET+CLR+1.1.4322;+.NET+CLR+3.0.04506.30;+
.NET+CLR+3.0.04506.648;+.NET+CLR+3.5.21022) 200 0 0
5/31/2009 1:00:06 10.10.10.11 GET /exchange
username10@domainname.com - 443 <client-ip> 
Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;
+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+.NET+CLR+3.0.04506.30;+
.NET+CLR+3.0.04506.648;+.NET+CLR+3.5.21022) 302 0 0

The CSV output is shown here.

Click to expand.

Related Reading:

Videos:

Audio:


Check out hundreds more useful Q&As like this in John Savill's FAQ for Windows. Also, watch instructional videos made by John at ITTV.net.

End of Article



Reader Comments

You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Top Viewed ArticlesView all articles
Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

WinInfo Short Takes: Week of November 9, 2009

An often irreverent look at some of the week's other news, including some more Windows 7 sales momentum, some Sophos stupidity, Microsoft's cloud computing self-loathing, more whining from the browser makers, Zoho's "Fake Office," and much, much more ...

Understanding File-Size Limits on NTFS and FAT

A general confusion about files sizes on FAT seems to stem from FAT32's file-size limit of 4GB and partition-size limit of 2TB. ...


Exchange Server and Outlook Whitepapers Take Control of Your Email: Understand the Business Reasons for Email Storage Management

Continuous Data Protection and Recovery for Microsoft Exchange

Related Events WinConnections and Microsoft® Exchange Connections

Check out our list of Free Email Newsletters!

Exchange Server and Outlook eBooks Spam Fighting and Email Security for the 21st Century

Understanding and Leveraging Code Signing Technologies

The Expert's Guide for Exchange 2003: Preparing for, Moving to, and Supporting Exchange Server 2003

Related Exchange Server and Outlook Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format

Exchange & Outlook UPDATE eNewsletter
News, strategies, products, and developments in Exchange Server and Outlook messaging.

Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement