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

New Contributor

So, I've asked this question before and received some excellent help from sharrison ( Thanks again!

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

My script:


tell application "System Events"
set the answer to text returned of (display dialog "Please enter the computer name" default answer "" buttons {"Rename"} default button "Rename")
end tell

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.




Contributor III

Can you clarify this?

Do you have this policy running automatically with a trigger such as login or recurring check-in?
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).