Running a sudo jams policy -v from Self Service (script or something like that)

dpratl
Contributor II

Hi all,

I know this thread is already quit old, but it is not closed and is the only thing I found about this.

I want to start

#!/bin/sh
sudo jamf policy -v

from the self service.
But this is not working because jamf is already running (I think because self service is open)

Does anyone have a clue how to do this?

Thank you
BR
Daniel

6 REPLIES 6

kbingham
New Contributor III

You should not need to have sudo in your script. All policies that are run in self service are already run as root.

You wouldn't actually need a script since you can create a policy that has a one line Run Command.

jamf policy -v

Then make that available in self service.

dpratl
Contributor II

Hi @kbingham,

Thank you for the hint.
I'm sorry but how can I create a policy to run one line command without using a script?

If I put that line

jamf policy -v

in a script and add it to a policy in Self Service I get this error if I run it:
8d281b285c874491ada740d292831b92

Its a pity but also in the Log (/var/log/jamf.log is no more information:
4a093c61724e45429e56b48c766c6cbd

Even the Console shows no more information:
b4aaa218663a417386364d7f017cf5d3

Thanks
BR
Daniel

kerouak
Valued Contributor

use Textwrangler, type in the command, save it as .txt
upload to JSS etc. etc.

dpratl
Contributor II

Hi @kerouak,

I'm sorry but I don't know what you mean. If I create a txt file and upload it to JSS via Casper Admin it is listed as unknown script and I cannot use it (not as a package nor as a script).
What I found was the function "Execute Command" in "Files and Processes" - I think @kbingham meant that. (?)
32b496e6339f47a19237e29e72f76473

But if I use it like that it is also not working, just Self Service gives no error. In the log I can see it is not working:
21d4f526560b4cb885ce1b8a56053daf
It is the same message as before when I was using a script:
8fe744edef774297a895d4e7a2c9f3a7

If I put jamf into the fiel search process and kill if found Self Service is search forever does not find the process (still got no log on JSS)

Any other ideas? Or do I do something wrong?

Am I the only one who thinks that that would be a great thing for my users to have?
Thank you
BR
Daniel

kerouak
Valued Contributor

Policy > Scripts> command.txt file. If you look here, you can see that .txt will actually show.
It will run as a command.....
088b2f130d2c452e9aec9e637b7b9e40

dpratl
Contributor II

Hi @kerouak,

Sorry for the delay. I don't know why it wasn't working in May, but now it is. I can add the txt file script but It is still not working.
6622886a48b447e6b535a14dd5bb18bf

How do you manage that? How is your Helpdesk telling a User "Hey I have marked this program for reinstallation on your Mac, please force the installation by clicking that in the Self Service"?

I'm thankful for any help or hint how you or everyone else is doing that?

Thank you
BR
Daniel