Jump to content

Recommended Posts

I've noticed lately that a lot of the time when I run commands against Mac OS X endpoints, the shell returns "OK" rather than the expected result of the command.  For example:

ls /Applications
OK

This happens when running commands interactively as well as when the commands are executed by a script - I enable script engine logging (and even explicitly log %shellresult% to the console) and the same thing happens: a long list of comments on what the command is doing, with "OK"s between them.

 

Does anyone know why this is happening and/or how to fix it?  Some Mac endpoints respond fine to shell commands, but then stop.  Others have a chain of "OK" entries in recent history but then respond fine to interactive commands when I test them.  Makes no sense to me.

Share this post


Link to post
Share on other sites

Try installing this monitor: https://www.labtechgeek.com/topic/3542-internal-monitors-for-duplicate-agents-using-the-same-id-or-single-agents-with-multiple-ids/

I have seen multiple OSX agents register under a single ID. If you submitted a command to one agent, and then another one checked in, weird things would likely occur. I really don't know if it would cause this issue. Normally the "OK" comes when the command reported nothing, or reported error output. Within the remote prompt you are in a directory (usually /tmp) and when you run a command, it actually runs "cd /tmp & <your command>". If the folder shown is invalid, that might cause your otherwise valid command to throw an error. (Just a thought..)

But I would start by ruling out the multiple agents issue with the help of those monitors.

 

Share this post


Link to post
Share on other sites

(Apologies for the necroposting.)

I'm glad I'm not alone in the frustration with trying to script shell commands on Mac agents. I'm getting a lot of "OK" or even weirder results. For instance, I'm trying to run a 'date' command (I need to populate a variable with "today's" date in a particular string format so I can then parse a log file looking for that string match) and yes, 'date' takes variables in %X format which Automate needs escaped by doubling up the % signs, great, fine.

So why does the Shell step of "date '+%%m/%%d/%%y'" give me a %shellresult% of "%m/%d/%y"? Argh. I can run the command (minus the extra % signs) in Terminal on a Mac endpoint and get the expected/desired outcome. I'm not asking for anything terribly complicated. I'm starting to feel like CW just kind of stopped all Mac-related development shortly after buying LabTech and I should not bother trying.

Automate Mac Script Shell Result Junk.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...