I’m trying to find java processes with command line arguments that contain a certain string. I have the relevance to get the results I want, but an unsure on how to return true if the command line arguments contain a string. For example:
Q: command line arguments of process "java"
A: -Declipse.security
A: -Dwas.status.socket=55601
A: -Dosgi.install.area=/web/was7nd/IBM/WebSphere/AppServer
A: -Dosgi.configuration.area=/web/was7nd/IBM/WebSphere/AppServer/profiles/Admin/configuration
A: -Djava.awt.headless=true
...
A: dmgr
E: Singular expression refers to non-unique object.
T: 4156
What would the relevance be to return true if any of the command line arguments contain “WebSphere”? I tried the following but came up short:
Q: exists command line arguments of process "java" whose it as lowercase contains "websphere"
E: A boolean expression is required.
Q: (exists command line arguments of process "java" whose it as lowercase contains "websphere") else (false)
E: This expression could not be parsed.
Ah, yes! That did it (using ‘of processes "java"’ since there are multiple java processes). I’m pretty sure you’ve told me that before and it’s the one thing that keeps biting me.
I completely agree. The command line is visible in the Windows Task Manager, so it should be available through an API somewhere. Perhaps an enhancement request is in order.
Agreed that this would be a good Idea to submit to the portal as an inspector enhancement!
In the meantime, it can technically be achieved via WMI inspectors with something like:
(string value of property "name" of it, string value of property "commandline" of it) of select objects "* from Win32_Process" whose (exists string value of property "commandline" of it AND string value of property "commandline" of it as lowercase contains "eventlog") of wmi