Remove Columns From Discover Pattern Table

Tom Rausch
Tera Guru

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"?

1 ACCEPTED SOLUTION

Tom Rausch
Tera Guru

ServiceNow indicates that this is expected behavior. I see the extra columns in other WMI queries.

The Discovery Process apparently accommodates these extra columns.

View solution in original post

3 REPLIES 3

Niklas Peterson
Mega Sage
Mega Sage

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


Tom Rausch
Tera Guru

I created Case CS6626939 "WMI Query For Two Fields Returns Five Fields" to address this issue.

Tom Rausch
Tera Guru

ServiceNow indicates that this is expected behavior. I see the extra columns in other WMI queries.

The Discovery Process apparently accommodates these extra columns.