Subscribe to Windows IT Pro

 

Get Newsletters

  • Get the Latest News
  • Product Updates
  • Helpful Tricks
  • Productivity Tips

Subscribe Now!

June 23, 2009 12:00 AM

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

Windows IT Pro
InstantDoc ID #102321
Rating: (0)

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.

Related Content:

ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

White Papers

Get your Windows 7 deployment off to the right start by implementing PC lockdown. A locked-down environment is easier and cheaper to support since users are less likely to make unnecessary changes to the core system configuration - read more here!

Essential Guides

Is your iSCSI "lossy"? The reality is that most off-the-shelf Ethernet hardware deployed for iSCSI can lose packets, resulting in slow performance or application downtime. Learn how to assess your current iSCSI infrastructure and engineer an advanced iSCSI SAN infrastructure.

Web Seminars

What's the best way to keep your network safe from malware? In this web seminar, security expert Greg Shields suggests an alternative method to the traditional blacklisting approach that is common with anti-virus and anti-malware solutions.

eLearning Series

We bring the experts direct to you to share their real-world perspective and expertise. During each event, three sessions stream in real time, so you can learn, ask questions, and get solutions.
Upcoming event: Getting the Most with Exchange 2010 with Paul Robichaux

Subscribe to Windows IT Pro!

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.