SCCM Last Run Datetime compare to lastHWscan

cyked
Mega Guru

I'm trying to solve an issue.   We've replaced workstation with discovery in favor of the SCCM integration and running into some issues in cases where machines are NOT being updated because of the time conversion/difference. lastHWscan is the value in SCCM we are using to evaluate against last run datetime.   If the date/time from SCCM is more recent than when the integration last run (last run datetime) the record should be pulled into the import and updated as needed.

The problem is that the SCCM database, I believe, is UTC and therefore 8 hours earlier than "current time".   So, if I look at the SCCM reports and find my laptop the report tells me lastHWscan is 2/27/2017 01:00:00.   When that CI record in CMDB is updated when the integration runs it shows most recent discovery (which is mapped in the tranform from lastHWscan from SCCM) as 2/27/2017 09:00:00.   This makes more sense. i wasn't online at 1AM where my machine via the SCCM agent would have checked in.   Essentially this creates an 8 hour window where machines have been more recently updated in SCCM than the last time the integration ran, but won't because of this 8 hour gap.

Question: I'm not sure where/how to fix this.   I've looked at the bus rule and UI Policy for last run datetime, but they don't seem to be what I'd need to update.   what I think would be best would be to find the snippet of code that does the compare and basically change it to " if lastHWscan +8 hours >= lastrundatetime" instead of just lastHWscan >= lastrundatetime.

1 ACCEPTED SOLUTION

cyked
Mega Guru

Here's the solution I came to.



After a bit more digging just on data sources I found that last run datetime was designed to reference the source data.   So if on a data source, SCCM or otherwise, you are using "use last run date/time" the last run datetime value will populate as the most recent value from DelDate from the source table (SCCM in this example).



Capture.PNG



The problem we ran into is that we have offshore users that connect to our network and they are hours ahead of us. So for the "SCCM 2012 v2 Computer Identity" data source for the SCCM integration last run datetime was reflecting a time in the future relative to my current time.   To address this problem I created a business rule (on before when record updated on sys_data_source) to update last run datetime and format it.   Now when the integration runs and last run datetime is set it will be my current time.





var sccm_time = gs.nowDateTime();


current.last_run_datetime = "'" + sccm_time + "'";


View solution in original post

4 REPLIES 4

cyked
Mega Guru

Here's the solution I came to.



After a bit more digging just on data sources I found that last run datetime was designed to reference the source data.   So if on a data source, SCCM or otherwise, you are using "use last run date/time" the last run datetime value will populate as the most recent value from DelDate from the source table (SCCM in this example).



Capture.PNG



The problem we ran into is that we have offshore users that connect to our network and they are hours ahead of us. So for the "SCCM 2012 v2 Computer Identity" data source for the SCCM integration last run datetime was reflecting a time in the future relative to my current time.   To address this problem I created a business rule (on before when record updated on sys_data_source) to update last run datetime and format it.   Now when the integration runs and last run datetime is set it will be my current time.





var sccm_time = gs.nowDateTime();


current.last_run_datetime = "'" + sccm_time + "'";


Oddly, today, 2/7/2025 - when I click use last run datetime, it auto-populates with 2024-02-13 using the field Timekey

MGanon
Tera Guru

Is it possible to set the integration to use the oldest scan date and not the most recent scan date?

In the sccm data source 'SCCM 2012 v2 Computer Identity' you can set the Last run database field.