I have a requirement where I need to fetch a report to pull all the active users in the SharePoint farm. We are using windows authentication in the farm.
Is there any way through which I can get the count of active users;
Below is query that I'm currently using in DB :
Select distinct tp_Title, d. dirname
from WSS_Content.dbo.UserInfo U inner join WSS_Content.dbo.AllDocs D
on U.tp_SiteID = D.SiteID
where tp_ExternalTokenLastUpdated > DATEADD(d,-1,SYSDATETIME())
But i do not want to query the DB instead want to find a way in Sharepoint to achieve this.
Any approach to achieve this will be appreciated.

