Hi All,
I am having a strange issue whilst deploying an applescript via self-service, it's written to rename the machine using the jamf helper based on the region the user selects via the UI. If i set the policy scope to ongoing the script re-runs immediately after exiting and loops forever, if i set it to once per computer the script kills after it has run once but i can see the jamf agent checking for the policy...all the time.. (screenshot attached).
Any ideas? The applescript is also below for any scripting gurus.
#!/bin/sh
#!/usr/bin/osascript
set Options to {"UK", "Ireland", "India", "Czech Republic", "Slovakia", "Poland", "Hungary", "Malaysia", "Thailand"}
on ActionA()
say "You chose United Kingdom"
do shell script "/usr/local/bin/jamf setComputerName -useSerialNumber -prefix 'UKMAC'"
return
end ActionA
on ActionB()
say "You chose Ireland"
do shell script "/usr/local/bin/jamf setComputerName -useSerialNumber -prefix 'IEMAC'"
end ActionB
on ActionC()
say "You chose India"
do shell script "/usr/local/bin/jamf setComputerName -useSerialNumber -prefix 'INMAC'"
end ActionC
on ActionD()
say "You chose Czech Republic"
do shell script "/usr/local/bin/jamf setComputerName -useSerialNumber -prefix 'CZMAC'"
end ActionD
on ActionE()
say "You chose Slovakia"
do shell script "/usr/local/bin/jamf setComputerName -useSerialNumber -prefix 'SKMAC'"
end ActionE
on ActionF()
say "You chose Poland"
do shell script "/usr/local/bin/jamf setComputerName -useSerialNumber -prefix 'PLMAC'"
end ActionF
on ActionG()
say "You chose Hungary"
do shell script "/usr/local/bin/jamf setComputerName -useSerialNumber -prefix 'HUMAC'"
end ActionG
on ActionH()
say "You chose Malaysia"
do shell script "/usr/local/bin/jamf setComputerName -useSerialNumber -prefix 'MYMAC'"
end ActionH
on ActionI()
say "You chose Thailand"
do shell script "/usr/local/bin/jamf setComputerName -useSerialNumber -prefix 'THMAC'"
end ActionI
set ListA to (choose from list Options with prompt "IMPORTANT: Please select the region your Mac belongs to" with title "Computer Naming") as text
if ListA is "UK" then
ActionA()
end if
if ListA is "Ireland" then
ActionB()
end if
if ListA is "India" then
ActionC()
end if
if ListA is "Czech Republic" then
ActionD()
end if
if ListA is "Slovakia" then
ActionE()
end if
if ListA is "Poland" then
ActionF()
end if
if ListA is "Hungary" then
ActionG()
end if
if ListA is "Malaysia" then
ActionH()
end if
if ListA is "Thailand" then
ActionI()
end if
return