When SG- SCCM query is changed from default where else must I change for it to Transform? TopConsoleUser
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2022 08:03 AM
Hello,
I recently upgraded to the newer Service Graph connector for SCCM. By default the query uses v_GS_SYSTEM_CONSOLE_USAGE.TopConsoleUser0 as username, however I changed it to v_GS_COMPUTER_SYSTEM.UserName0 as username, as we need to know who it belongs to. This seems like the most logical choice. My problem is when I did a Test load of 20 records the field in sn_sccm_integrate_sccm_2019_computer_id table had the correct data, however, when ran the transform it still left the username field blank within the CMDB but should have populated with a username.
What would I need to do? I changed system.Name quite some time ago and it appears ok however I better validate that again.
Is there someplace that I need to change code or something for it to transform? I am also wondering if the null fields in either source or target need to be treated differently, if so how?
Lastly what would happen if I uncheck 'use last run datetime'?
Thanks kindly.
SELECT
v_R_System.Name0 as name,
v_GS_COMPUTER_SYSTEM.domain0 as domain,
v_GS_COMPUTER_SYSTEM.Model0 as model,
v_GS_COMPUTER_SYSTEM.Manufacturer0 as manufacturer,
v_GS_COMPUTER_SYSTEM.ResourceID,
v_GS_COMPUTER_SYSTEM.UserName0 as username,
v_GS_COMPUTER_SYSTEM.NumberOfProcessors0 as numberofprocessors,
v_GS_SYSTEM.SystemRole0 as SystemRole,
v_GS_OPERATING_SYSTEM.Caption0 as caption,
v_GS_OPERATING_SYSTEM.Version0 as Version,
v_GS_SYSTEM_ENCLOSURE.ChassisTypes0 as chassistype,
WorkstationStatus_DATA.LastHWScan,
v_GS_PC_BIOS.SerialNumber0 as BIOSSerialNumber,
v_GS_COMPUTER_SYSTEM_PRODUCT.IdentifyingNumber0 as SystemSerialNumber,
v_GS_COMPUTER_SYSTEM_PRODUCT.UUID0 as UUIDSerialNumber,
v_GS_SYSTEM_ENCLOSURE.SerialNumber0 as ChassisSerialNumber,
v_GS_BASEBOARD.SerialNumber0 as BaseboardSerialNumber,
WorkstationStatus_DATA.TimeKey as TimeKey,
v_GS_OPERATING_SYSTEM.TimeStamp as OsTimeStamp,
v_R_System.Creation_Date0 as AssignedDate,
null as OUName,
v_GS_SYSTEM_ENCLOSURE.SMBIOSAssetTag0 as AssetTag
FROM v_GS_COMPUTER_SYSTEM
LEFT JOIN WorkstationStatus_DATA ON v_GS_COMPUTER_SYSTEM.ResourceID = WorkstationStatus_DATA.MachineID
LEFT JOIN v_GS_SYSTEM ON v_GS_COMPUTER_SYSTEM.ResourceID = v_GS_SYSTEM.ResourceID
LEFT JOIN v_GS_PC_BIOS ON v_GS_COMPUTER_SYSTEM.ResourceID = v_GS_PC_BIOS.ResourceID
LEFT JOIN v_GS_OPERATING_SYSTEM ON v_GS_COMPUTER_SYSTEM.ResourceID = v_GS_OPERATING_SYSTEM.ResourceID
LEFT JOIN v_GS_COMPUTER_SYSTEM_PRODUCT ON v_GS_COMPUTER_SYSTEM.ResourceID = v_GS_COMPUTER_SYSTEM_PRODUCT.ResourceID
LEFT JOIN v_GS_SYSTEM_ENCLOSURE ON v_GS_COMPUTER_SYSTEM.ResourceID = v_GS_SYSTEM_ENCLOSURE.ResourceID
LEFT JOIN v_GS_BASEBOARD ON v_GS_COMPUTER_SYSTEM.ResourceID = v_GS_BASEBOARD.ResourceID
LEFT JOIN v_GS_SYSTEM_CONSOLE_USAGE ON v_GS_COMPUTER_SYSTEM.ResourceID = v_GS_SYSTEM_CONSOLE_USAGE.ResourceID
LEFT JOIN v_R_System ON v_GS_COMPUTER_SYSTEM.ResourceID = v_R_System.ResourceID
- Labels:
-
Service Graph Connector

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2022 09:02 AM
As long as the data is being inserted correctly into the import set table (sn_sccm_integrate_sccm_2019_computer_id) your sql query is correct. In this case both the OOTB and your customization are aliasing the actual column name as username so the data will end up in the u_username column in the import set table. As long as the data is landing in the same column you shouldn't have to make any further modifications.
As to why the data isn't being reflected in the CMDB let's first take a look at the flow through the RTE (I'm looking at the latest version of SCCM FYI):
The u_username field is being passed to the Set assigned_to operation which is a script operation:
Here we can see a couple of things.
1) It is reading the property glide.discovery.assigned_user_match_field to find what field on the sys_user table to match against. By default it is user_name.
2) It is doing some parsing of the username from SCCM to strip out the username from the input value (removing the part prior to a \\ or /)
From this you may want to
One way we can get a better understanding is by looking at the IntegrationHub-ETL to see if the assigned_to field has a sys_id. If it does that means that we are correctly matching.
If you are seeing a sys_id in the IntegrationHub-ETL that means we are matching correctly and something else is happening to prevent an update.
I would look into the sys_object_source table for the target CI. Oftentimes the data you are running is not newer than pervious data so the IRE will ignore it (even if the mapping has changed). This is determined by the last scan date on the sys_object_source table. To remediate this, you could delete records in the sys_object_source table where the target sys id is the computer you are expecting changes on.
As to what will happen if you uncheck 'use last run datetime' field. This is used to window the sql query. It will add a where clause to filter to only data that has been refreshed since the last run. By unchecking it you will return all data from SCCM. This is mainly used to prevent reprocessing stale data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2022 10:34 AM
Hi and thank you!! So now I am in unexplored territory. 🙂
Within IntegrationHub / templates. I searched sys and the only sysID I see is connectionSysId. There was some about retry policies...
Am I in the right place?
_____________________________________________________
Re: sys_object_source
Oh my I have over 3 million records there on Target table name contains 'computer'. I have over 3,000 on this one example record 16779628. I included a screenshot with dates from each one of the tables. Is this a case where deleting it from sys-object_source would correct it?
What would be ramifications if I deleted all these millions of records?
Why do we need all these records in there?
_______________________________________________________
Re: use last run datetime
If I removed this checkmark will it
Cause duplicates?
Update with all the changes I made in the query (username)?
thanks a lot!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2022 05:52 AM
Am I in the right place?
You are not in the correct place. It is a store application called the IntegrationHub ETL. This is a UI tool used to see the mappings and modify Service Graph connectors. Once it is installed it will appear in the left navigation as IntegrationHub ETL.
Is this a case where deleting it from sys-object_source would correct it?
Deleting records in the sys_object_source table will just force the integration to go through the IRE rules again instead of shortcutting them by going directly to the target sys id from the source native key. I would recommend deleting records targeting a specific target sys id to limit the scope for debugging.
What would be ramifications if I deleted all these millions of records?
As mentioned above it will force the integration to go through the IRE rules instead of the target sys id lookup.
Why do we need all these records in there?
It improves performance by reducing the number of IRE calls. If you have already identified a CI for a given SCCM record there isn't much value in identifying it every time the integration is run. Also if the last scan isn't newer there presumably isn't any new data and the CI won't need to be updated.
If I removed this checkmark will it cause duplicates?
No, it will just fetch all data from SCCM instead of an incremental amount of data where the records have been updated. It will cause significant performance degradation as you will be fetching all records instead of only those changed.
Update with all the changes I made in the query (username)?
I'm not sure what this question is refering to.
Here is a screenshot of the IntegrationHub ETL preview data where you can see the username and the assigned_to sys id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2023 04:34 AM
Hi, we have this issue as well where the custom SQL statement is being overwitten, for me, i would like to assign computers using the user's email as we are not syncing the usernames in format that OOB expects it.
Here is the row I have modified to retrieve the user's email instead of their username:
v_R_User.User_Principal_Name0 as username,
And my whole SQL (custom) looks like this:
SELECT
v_GS_COMPUTER_SYSTEM.Name0 as name,
v_GS_COMPUTER_SYSTEM.domain0 as domain,
v_R_System.AD_Site_Name0 as adsite,
v_R_User.User_Principal_Name0 as username,
v_R_System.description0 as description,
v_GS_COMPUTER_SYSTEM.Model0 as model,
v_GS_COMPUTER_SYSTEM.Manufacturer0 as manufacturer, v_GS_COMPUTER_SYSTEM.ResourceID,
v_GS_COMPUTER_SYSTEM.NumberOfProcessors0 as numberofprocessors,
v_GS_SYSTEM.SystemRole0 as SystemRole,
v_GS_OPERATING_SYSTEM.Caption0 as caption,
v_GS_OPERATING_SYSTEM.Version0 as Version,
v_GS_SYSTEM_ENCLOSURE.ChassisTypes0 as chassistype,
CONVERT(datetime, SWITCHOFFSET(TODATETIMEOFFSET(WorkstationStatus_DATA.LastHWScan,datepart(tz,SYSDATETIMEOFFSET())),0)) AS LastHWScan,
v_GS_PC_BIOS.SerialNumber0 as BIOSSerialNumber,
v_GS_COMPUTER_SYSTEM_PRODUCT.IdentifyingNumber0 as SystemSerialNumber,
v_GS_COMPUTER_SYSTEM_PRODUCT.UUID0 as UUIDSerialNumber,
v_GS_SYSTEM_ENCLOSURE.SerialNumber0 as ChassisSerialNumber,
v_GS_BASEBOARD.SerialNumber0 as BaseboardSerialNumber,
WorkstationStatus_DATA.TimeKey as TimeKey,
v_GS_OPERATING_SYSTEM.TimeStamp as OsTimeStamp,
v_R_System.Creation_Date0 as AssignedDate, null as OUName,
v_GS_SYSTEM_ENCLOSURE.SMBIOSAssetTag0 as AssetTag , '03066860c7122010b56243ac95c26027' as connectionid
FROM v_GS_COMPUTER_SYSTEM
LEFT JOIN WorkstationStatus_DATA ON v_GS_COMPUTER_SYSTEM.ResourceID = WorkstationStatus_DATA.MachineID
LEFT JOIN v_GS_SYSTEM ON v_GS_COMPUTER_SYSTEM.ResourceID = v_GS_SYSTEM.ResourceID
LEFT JOIN v_GS_PC_BIOS ON v_GS_COMPUTER_SYSTEM.ResourceID = v_GS_PC_BIOS.ResourceID
LEFT JOIN v_GS_OPERATING_SYSTEM ON v_GS_COMPUTER_SYSTEM.ResourceID = v_GS_OPERATING_SYSTEM.ResourceID
LEFT JOIN v_GS_COMPUTER_SYSTEM_PRODUCT ON v_GS_COMPUTER_SYSTEM.ResourceID = v_GS_COMPUTER_SYSTEM_PRODUCT.ResourceID
LEFT JOIN v_GS_SYSTEM_ENCLOSURE ON v_GS_COMPUTER_SYSTEM.ResourceID = v_GS_SYSTEM_ENCLOSURE.ResourceID
LEFT JOIN v_GS_BASEBOARD ON v_GS_COMPUTER_SYSTEM.ResourceID = v_GS_BASEBOARD.ResourceID
LEFT JOIN v_GS_SYSTEM_CONSOLE_USAGE ON v_GS_COMPUTER_SYSTEM.ResourceID = v_GS_SYSTEM_CONSOLE_USAGE.ResourceID
LEFT JOIN v_R_user ON v_GS_SYSTEM_CONSOLE_USAGE.TopConsoleUser0 = v_R_User.Unique_User_Name0
LEFT JOIN v_R_System ON v_GS_COMPUTER_SYSTEM.ResourceID = v_R_System.ResourceID
order by name