Skip to main content
Question

Rename computer via self service with dialog box

  • September 28, 2022
  • 1 reply
  • 2 views

Forum|alt.badge.img+3

I want a simple script to add to self service which will give me a dialog box with some selection/drop-down and some text boxes which will all tie together at the end to create the name and then recon to push to jamf.

Drop-down will have 4 choices each and everything will be selected manually.

Final name will be

Example: NA.John.Doe.M1Pro14

1 reply

pete_c
Forum|alt.badge.img+16
  • Honored Contributor
  • 252 replies
  • September 28, 2022

Use cocoaDialog or osascript to capture names if you're not assigning them in the Jamf Pro server first - see here for a good start - but why give users the option to incorrectly enter hardware info?  Just grab it programmatically:

 

serial=$(ioreg -c IOPlatformExpertDevice -d 2 | awk -F\\" '/IOPlatformSerialNumber/{print $(NF-1)}')
model=$(/usr/sbin/sysctl -n hw.model)
hwmodel=$(ioreg -l | awk '/product-name/ { split($0, line, "\\""); printf("%s\\n", line[4]); }')
platform=$(/usr/bin/arch)
processor=$(/usr/sbin/sysctl -n machdep.cpu.brand_string)

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings