We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Retrieve Last Logon via Service graph connector for SCCM

ponranjitha
Tera Contributor

Hi Team,
I need help on retrieving Last LogOn Date of computer via Service Graph Connector for SCCM.
Please help on adding SQL Query in "SG-SCCM Computer Identity" Data Source.

1 REPLY 1

JerryJ071847183
Tera Sage

I think you should connect with SQL team to get proper SQL query from their side as all things and parameters might differ like database name , field names, exact table name etc

 

However, if you just want a sample query  you can check below for reference

 

SELECT
DISTINCT SYS.Netbios_Name0 AS [Name],
SYS.ResourceID AS [Resource ID],
SYS.Operating_System_Name_and0 AS [Operating System],
SYS.Client_Version0 AS [Client Version],
SYS.Manufacturer0 AS [Manufacturer],
SYS.Model0 AS [Model],
SYS.User_Name0 AS [Primary User],
OS.LastLogonDate AS [Last LogOn Date]
FROM
v_R_System AS SYS
LEFT JOIN
v_GS_OPERATING_SYSTEM AS OS
ON
SYS.ResourceID = OS.ResourceID

 

------------------------------------------------------------------------------------

v_GS_OPERATING_SYSTEM: Stores operating system details, including the LastLogonDate.

Ensure the SCCM database has the LastLogonDate column populated.