I have made a script, with help from other scripts found online, that will take user input and then update user information on JAMF Pro.
All working apart from where you enter the staff/students full name for example "John Smith", script is only reading the first word on the input and updating JAMF = John. Been on this for a few hours trying anything that I can find and now I am at a loss of what I can try to sort this.
Any help on this would be very welcome :)
JAMF_FULLNAME=`/usr/bin/osascript << EOT
tell application "System Events"
activate
set JAMF_FULLNAME to text returned of (display dialog "Please enter fullname " default answer "")
end tell
EOT`
#Store input full name
echo $JAMF_FULLNAME
-------------------------------------------------------------------------------------------------------
Complete script for information:
#!/bin/sh
echo ""
#1. Get user input for username
JAMF_USERNAME=`/usr/bin/osascript << EOT
tell application "System Events"
activate
set JAMF_USERNAME to text returned of (display dialog "Please YYD Username " default answer "")
end tell
EOT`
#Store input for username
echo $JAMF_USERNAME
wait
echo ""
#2. Get user input for full name
JAMF_FULLNAME=`/usr/bin/osascript << EOT
tell application "System Events"
activate
set JAMF_FULLNAME to text returned of (display dialog "Please enter fullname " default answer "")
end tell
EOT`
#Store input full name
echo $JAMF_FULLNAME
wait
echo ""
#3. Get user input for email
JAMF_EMAIL=`/usr/bin/osascript << EOT
tell application "System Events"
activate
set JAMF_EMAIL to text returned of (display dialog "Please YYD email " default answer "")
end tell
EOT`
#Store input for email
echo $JAMF_EMAIL
wait
echo ""
#4. Get user input for job role
JAMF_POSITION=`/usr/bin/osascript << EOT
tell application "System Events"
activate
set JAMF_POSITION to text returned of (display dialog "Please enter job role (i.e. Teacher, ICT Support, Head Teacher) " default answer "")
end tell
EOT`
#Store input job role
echo $JAMF_POSITION
wait
echo ""
#5. Get user input for site
JAMF_BUILDING=`/usr/bin/osascript << EOT
tell application "System Events"
activate
set JAMF_BUILDING to text returned of (display dialog "Please enter YD site (PLC, DN, LD) " default answer "")
end tell
EOT`
#Store input for site
echo $JAMF_BUILDING
wait
echo ""
#6. Get user input for YD asset
JAMF_ASSET=`/usr/bin/osascript << EOT
tell application "System Events"
activate
set JAMF_ASSET to text returned of (display dialog "Please enter YD asset " default answer "")
end tell
EOT`
#Store input for YD asset
echo $JAMF_ASSET
wait
echo ""
#Send user input to JAMF Pro instance
sudo jamf recon -skipPlugins -skipFonts -skipApps -assetTag ${JAMF_ASSET} -position ${JAMF_POSITION} -realname ${JAMF_FULLNAME} -email ${JAMF_EMAIL} -endUsername ${JAMF_USERNAME} -building ${JAMF_BUILDING}