I wish to know the possible ways to find out the count of all currently logged in users across all the SharePoint site collections in a farm.

For example (users logged into sites)

John - http://webapp1/sites/portal

Jack - http://webapp1/sites/portal

John - http://webapp1/sites/corporate

Derek - http://webapp2:90/sites/dashboard

The output desired from a program/script is it can give me the total unique visitors with active sessions across all these site collections


Things I have tried so far

IIS Log Parser way

SQL Queries to the content database of the web application

FROM [WSS_Content_Databasename].[dbo].[UserInfo]
WHERE tp_ExternalTokenLastUpdated > '2012-03-31'
AND tp_Token != 'NULL'

Both the above ways are bound by limitations like parsing IIS logs from multiple WFEs and manually querying all content databases becomes an overhead.Additionally I am not really sure if either of them are the right approach for achieving this.

I read a good number of webpages from Google and the only definite conclusion I have is there are no out of the box way in SharePoint to achieve this. Please somebody guide me here.

2 Answers 2


Log Parsing or web analytics in general will give you good historical info, but generally not good real-time information.

Querying the content database should absolutely not be done. Microsoft says that doing so will void any warranty or support. Anyone that has poked around with SharePoint enough will know that trying it absolutely does create problems within the environment.

If you have a need for real-time info then you will either need add some custom code to the master page that can write or report out active session information to a centralized source or you will need to interface with the standard Windows Management Instrumentation (WMI) counters which include the ability to get the current session count information for a given web server or break it down for each web application.

My preference would be to use the WMI in nearly all cases.


Take a look at http://spcurrentusers.codeplex.com which may serve as a starting point. It's my solution, in case you're wondering :-)


  • Was about to suggest that :-D. And combination of your solution and powershell to query the fields / lists used by your solution would result in an overview that could be grouped per site collection, per web application.
    – Colin
    Commented Mar 31, 2012 at 23:13
  • awesome solution :) Commented Jun 5, 2012 at 9:58
  • 2
    Does this work with SharePoint 2010? Have you thought about recreating this solution with VS 2010?
    – rgwaldron
    Commented Oct 29, 2013 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.