Get Last Access Times of System Users from Dynamics CRM database

Hi everyone,

We sometimes may need to know when was the last time for a particular CRM user accessed/logged in to Dynamics CRM. In MSCRM_CONFIG database which is one of two databases when a CRM organization is installed, we have a table named as SystemUserOrganizations. With the help of this table and columns belong to it we can get the information about when was the last access time of a user in Dynamics CRM.

Here is the script for it. You may want to run this script for only after a specific time period so I remarked that condition in a comment saying “OPTIONAL” below.

SELECT su.DomainName,suo.LastAccessTime 
  FROM [MSCRM_CONFIG].[dbo].[SystemUserOrganizations] suo
  inner join CRMTEST_MSCRM..SystemUserBase su
	on suo.CrmUserId = su.SystemUserId
		where suo.LastAccessTime > '2018-01-02 21:00:00.000' -- OPTIONAL
	order by suo.LastAccessTime

Hope that helps!

Leave a Reply

Your email address will not be published. Required fields are marked *