Small shop so there not much need to automate much but to Rename laptops we've been editing them in Jamf Pro and then running a Policy that connects script:
!/bin/bash
ComputerName="$4"
scutil --set HostName $ComputerName
scutil --set LocalHostName $ComputerName
scutil --set ComputerName $ComputerName
To an "App" made available via scoping in Self Service. It works but seems like I'm doubling my workload.
I'd like to keep the Self Service app and initiate the naming from it using a script like:
!/bin/bash
newName=$( osascript -e 'text returned of (display dialog "Enter a new name for your Mac..." default answer "" with title "Name Your Computer" with icon file posix file "/System/Library/CoreServices/Finder.app/Contents/Resources/Finder.icns")' )
scutil --set ComputerName "$newName"
echo "Setting ComputerName to $newName"
exit 0
This 2nd script works if I run it from Terminal on the laptop but cannot get it to work on a cloned version of the original Self Service app. I was hoping that if I could get the 2nd script to initiate through Self Service that the "Update Inventory" option under Maintenance could then push that new name to Jamf Pro. I'm fairly certain I'm chasing moondust with this last part, but would still like to get the 2nd script working as a part of an app.
Any help appreciated.
