
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2023 04:56 PM
Question
Can I remove unwanted columns from Discovery Pattern tables? If so, how?
Use Case
I run this WMI query and put the results into a Discovery Pattern table "$db_query_results".
SELECT Name,DataFilesSizeKB FROM Win32_PerfFormattedData_MSSQLSERVER_SQLServerDatabases
The query returns the columns "Name" and "DataFilesSizeKB" but also returns some unwanted columns as well: "database", "internal_classname", "internal_where", "OBJECT_REFERENCE", "internal_namespace", "__CLASS=Win32_PerfFormattedData_MSSQLSERVER_SQLServerDatabases",
and "row_number".
{database=DMCRM,
name=DMCRM,
internal_classname=Win32_PerfFormattedData_MSSQLSERVER_SQLServerDatabases,
internal_where=name = 'DMCRM',
OBJECT_REFERENCE=null,
u_size_db=70.83050537109375,
internal_namespace=root/cimv2,
DataFilesSizeKB=74271168,
__CLASS=Win32_PerfFormattedData_MSSQLSERVER_SQLServerDatabases,
row_number=1,
Name=DMCRM}])
2023-04-18 00:50:14: Execution time: 0 ms
All these columns end up in the Discovery Pattern table "$db_query_results".
How can I remove these unneeded and unwelcome columns from the Discovery Pattern table "$db_query_results"?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2023 06:20 AM
ServiceNow indicates that this is expected behavior. I see the extra columns in other WMI queries.
The Discovery Process apparently accommodates these extra columns.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2023 11:59 PM
Hi,
The "$db_query_results" is dynamically built by the returned result so the trick would be to only return the properties you are intested in.
The question here is why do you get more properties in the result than you ask for? Seems to me the syntax of the WMI query is not working as it should. You are only querying for Name and DataFilesSizeKB but the result looks more like you are querying for *.
Regards,
Niklas

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2023 03:47 PM
I created Case CS6626939 "WMI Query For Two Fields Returns Five Fields" to address this issue.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2023 06:20 AM
ServiceNow indicates that this is expected behavior. I see the extra columns in other WMI queries.
The Discovery Process apparently accommodates these extra columns.