Setting Computer Name through Self Service, but with a button?

kevin_neely
New Contributor

So, I've asked this question before and received some excellent help from sharrison (https://www.jamf.com/jamf-nation/discussions/37206/set-new-computer-name-and-update-in-jamf-pro). Thanks again!

But I'm looking to refine it a bit, and I think my solution is through the Trigger.

My script:

!/bin/bash

username=$(/usr/bin/osascript<<END
tell application "System Events"
activate
set the answer to text returned of (display dialog "Please enter the computer name" default answer "" buttons {"Rename"} default button "Rename")
end tell
END)

echo $username
/usr/local/bin/jamf setcomputername -name $username

/usr/local/bin/jamf recon

I want it to run when I click a button in Self Service. Not just show up as an ongoing or recurring event, but always be available.

Right now, to make it available in Self Service makes the Rename box created in the script always pop up (see pic). I just want it to pop up when I click the "Change Name/Change Again" button is clicked.

Thoughts?

c1097973db4343a3bc5a8855e87732b2

1 REPLY 1

atomczynski
Contributor III

Can you clarify this?

Do you have this policy running automatically with a trigger such as login or recurring check-in?
AND
in Self Service?

If you want this to be presented through Self Service only, you would want it as a separate policy.

Self Service tab:
check Make ths policy available in Self Service

Options tab:
No triggers,
Execution Frequency: ongoing (if you want to be able to rerun the policy), or set to one time (and flush the log for this policy for that specific computer, or group, or all).