Get DESCRIPTION of SERVICES

(imported topic written by Matt.Johnson)

I am trying to get several values from a query to put in to a property. However, I cannot find the variable to use to get the general description of each service. Here is what I have:

q:(service names of it, display name of it, image paths of it, state of it) of services

and I get an answer:

A: AdobeARMservice, Adobe Acrobat Update Service, “C:\Program Files (x86)\Common Files\Adobe\ARM\1.0\armsvc.exe”, Running

What I am looking for is to get the description of the service, e.g.:

A: AdobeARMservice, Adobe Acrobat Update Service,

Adobe Acrobat Updater keeps your Adobe software up to date.“
C:\Program Files (x86)\Common Files\Adobe\ARM\1.0\armsvc.exe”, Running

Can someone tell me how to achieve this?

Thank you!

Matt Johnson

(imported comment written by sinucus)

As far as I know from the product documentation, that is not available through the Relevance language. You can use wmi though.

q: (selects “name, description from win32_service” of wmi as string)

(imported comment written by Matt.Johnson)

Thanks Sincus,

How could I translate the whole string to get the same result?

of
service names, display name, image paths, state in one property (as string)

(imported comment written by sinucus)

I actually don’t have a working answer for you as these are the types of problems I always run into with relevance.

The following line returns the services as 1 line each but it outputs terribly. I think it has to do something with UTF-8 encoding. Hopefully one of the other relevance experts can chime in here…

q: select objects (“name, description from win32_service”) of wmi

(imported comment written by sinucus)

Actually, try this… It might bomb out on you if one of the properties is missing though. :frowning:

q: ((substring after “=” of (property “Name” of it as string) & ", " & (substring after “=” of (property “Description” of it as string)) & ", " & (substring after “=” of (property “PathName” of it as string)) & ", " & (substring after “=” of (property “State” of it as string))) of select objects (“Name,Description,PathName,State from win32_service”) of wmi)

(imported comment written by Lee Wei 2)

Sorry for budging in on your discussion.

I saw this and this is another way of doing it.

( string value of property “name” of it,
string value of property “description” of it,
string value of property “pathname” of it,
string value of property “state” of it
) of select objects “* from win32_service” of wmi

(imported comment written by sinucus)

Thanks for you input on this, your code is definitely cleaner than mine, but it still breaks the same way as mine.

If one of the fields is missing it returns a E: Singular expression refers to nonexistent object and stops processing. We need to throw some “if exists” in there somewhere.

(imported comment written by martinc)

how about adding the “| “n/a”” to the statement. For example:

(string value of property “name” of it | “n/a”, string value of property “description” of it | “n/a”, string value of property “pathname” of it | “n/a”, string value of property “state” of it | “n/a”) of select objects “* from win32_service” of wmi

This seemed to work on my test system.

(imported comment written by sinucus)

Fantastic! I’ll keep that in mind for the future. Those Or “n/a” worked perfectly.

(imported comment written by Matt.Johnson)

Thank you all for your assistance, I had this up and running last night thanks to you.

It’s great that there are people like you in these forums that make using TEM language easier to use!

Thank you,

Matt Johnson