WMIC thestery – why is this query invalid

wmi

Why is this an invalid query?

wmic service where 'caption like "%documentum%"' get name, caption  

Node - PE95AOECM  
ERROR:  
Description = Invalid query  

This is the expected output:

Caption                                 Name  
EMC Documentum Thumbnail Server         DctmThumbnailServer  
Documentum Docbroker Service Docbroker  DmDocbroker  
Documentum Java Method Server           DmMethodServer  
Documentum Docbase Service KxKDOC_DEV   DmServerKxKDOC_DEV  
Documentum Docbase Service KxKTAX_DEV   DmServerKxKTAX_DEV  
Documentum Docbase Service KxK_Dev      DmServerKxK_Dev  
Documentum Docbase Service KxK_Dev_HRP  DmServerKxK_Dev_HRP  
Documentum Docbase Service KxK_Dev_TAX  DmServerKxK_Dev_TAX  

If I modify the query slightly I do in fact get a valid response similar to the above:

removed the first %

wmic service where 'caption like "documentum%"' get name, caption  

added a space after documentum

wmic service where 'caption like "%documentum %"' get name, caption  

removed the last m of documentum

wmic service where 'caption like "%documentu%"' get name, caption  

and as an example of a similar case where I query for the first word of a multi-word caption is successful

wmic service where 'caption like "%group%"' get name, caption  

Caption              Name  
Group Policy Client  gpsvc  

Best Answer

Try an echo wmic service where 'caption like "%documentum%"' get name, caption and you can see what's going on. You can also do echo %documentum%.

(It should echo the exact command back, including the %documentum%)

Maybe you have an environment variable named documentum.
(environment variables have precedence over the command parameters. So if they are present, they get substituted.)

You can do set documentum= and then execute the line to empty the variable (if set).