Can't use double-quotes in policy Run Command field

talkingmoose
Honored Contributor II

I'm needing to run a simple one-line script on some machines via policy but
the language is AppleScript. Therefore, I'm preceding that with the
"osascript -e" to run it as a shell script.

In the policy under the Advanced tab I'm adding this to the Run Command
field (all one line):

osascript -e 'tell application "ColorSyncScripting" to set system profile to
profile "HP L1906 Calibrated_Sam"'

However, after saving the policy the line is truncated to

osascript -e 'tell application

I've tried changing the command to use double-quotes, escaping the
double-quotes in AppleScript command (all one line):

osascript -e "tell application "ColorSyncScripting" to set system profile
to profile "HP L1906 Calibrated_Sam""

But this truncates to

osascript -e

Apparently, double-quotes aren't allowed in this field, but AppleScript
requires the double-quotes.

I'm assuming this is a bug because the command does work in Terminal. Does
anyone have a workaround?

bill
-- William M. Smith, Technical Analyst
Digital Information Systems Support
Merrill Communications, LLC
(651) 632-1492

2 REPLIES 2

talkingmoose
Honored Contributor II

Thanks, Nick! That's what I'll do.

This leads me to an idea for a feature request:

Script files are currently stored on the file repository volume (or in
my case multiple volumes) and in order to be executed the volume must be
first mounted then the script must be copied locally (I believe) and
then run.

The JSS itself might be an ideal place for storing scripts. I'm
envisioning a page for each script in Casper Admin just like what's
available now, but it also contains a scrollable field where shell
script text can be copy/pasted and/or edited. Doesn't have to be a big
field since most editing would probably happen outside in a text editor
anyway.

This setup would avoid me having to maintain multiple copies of the same
script in each of my locations and may even be faster in execution. I
wouldn't think the network overhead for even large amounts of script
text would be significant.

bill
-- William M. Smith, Technical Analyst
Digital Information Systems Support
Merrill Communications, LLC
(651) 632-1492

zach
New Contributor III

Hey Bill-

We were actually very close to implementing this in the upcoming release (like we have for the PPDs for printers), but there where a few things that held us back. Mainly, we have a number of clients that put complied applications (even .app bundles) into our scripting framework. These are obviously harder to store in the database than a standard shell script.

I think we will be able to find a way to give you both in the near future.

regards,
zach