Finding a process's file path (or directory) on OSX

I’m working with the Bomgar remote system, and trying to build a task that uninstalls their client via command line. After sleuthing around a bit on this annoyingly underdocumented client, I found the executable has an -uninstall option. But, the path varies according to an internal serializing system:

/Users/Shared/bomgar-scc-[string].app/Contents/MacOS/sdcust

I can use relevance to find systems that have a running copy of sdcust…

exist process whose (name of it is "sdcust")

…but the Mac inspectors don’t provide processes’ command line and arguments. (Rant: And really, why doesn’t ‘exist process “sdcust”’ work??)

Can relevance discover and parse a variable path? (On OSX they also write launch plists, but those filenames are similarly serialized.)

Thanks,
Andrew

Yes, you can get folders or files or other things without actually needing to know the exact path:

pathname of files "Contents/MacOS/sdcust" of folders whose(name of it as lowercase starts with "bomgar-scc-" AND name of it as lowercase ends with ".app") of folders "/Users/Shared"

Brilliant! Thank you James.

I’ll look at that… seems like a parity issue (as it works on Windows)

1 Like

Pinning it down a bit more, this worked for me:

pathname of files “sdcust” of folders “Contents/MacOS” of folders whose (name of it as lowercase starts with “bomgar-scc-” AND name of it as lowercase ends with “.app”) of folders “/Users/Shared”

Thank you @AlanM. At the moment (pathname of process “sdcust”) would be immensely helpful. :smile:

And FWIW, whilie this works in the Mac QnA

exist process whose (name of it is "sdcust")

It doesn’t seem to work as a task relevance.

That should be equivalent to my relevance.

That actually makes no sense (its the same code) so I’ll have to look at that too

Alas, @jgstew, your relevance didn’t resolve for me in QnA.

1 Like

FWIW, I’m using client 9.2.4.2 on OS X 10.10.3.

Interesting. I didn’t test it in QnA but it should work on Windows… I just assumed it worked on Mac the same way.

Following up…

Turns out this was a PEBCAK error. I had the task in a site where it couldn’t possibly be relevant.

Apologies…

1 Like