From f2060897f6625d8f804a9954945ab131f7453a0b Mon Sep 17 00:00:00 2001 From: wattsy74 <49881777+wattsy74@users.noreply.github.com> Date: Fri, 29 Oct 2021 11:19:51 +0100 Subject: [PATCH] Update --- computer-assignment.sh | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/computer-assignment.sh b/computer-assignment.sh index 4797516..d89cd46 100644 --- a/computer-assignment.sh +++ b/computer-assignment.sh @@ -25,13 +25,41 @@ echo "email.width = 340" >> $PashuaConfig # Launch Pashua to gather the info -/tmp/Pashua.app/Contents/MacOS/Pashua $PashuaConfig +result=`/tmp/Pashua.app/Contents/MacOS/Pashua $PashuaConfig | sed 's/ /;;;/g'` -# OLD METHOD - Open a dialog window asking for the email address of the user and assign to the UserID variable -# OLD METHOD - UserID=$(osascript -e 'display dialog "Please enter the email address for the person who will be using this computer" with title "Computer Assignment Question 1 of 2" default answer "@berkshireifa.com" buttons {"Next"} default button 1' | cut -f3 -d":") +# Parse result +for line in $result +do + key=`echo $line | sed 's/^\([^=]*\)=.*$/\1/'` + value=`echo $line | sed 's/^[^=]*=\(.*\)$/\1/' | sed 's/;;;/ /g'` + varname=$key + varvalue="$value" + eval $varname='$varvalue' +done -# OLD METHOD - Open a dialog window asking for the Full Name of the user and assign to the realName variable -# OLD METHOD - realName=$(osascript -e 'display dialog "Please enter the full name for the person who will be using this computer" with title "Computer Assignment Question 2 of 2" default answer "Firstname Lastname" buttons {"Next"} default button 1' | cut -f3 -d":") +# jamf recon -endUsername "${email}" -realname "${fullname}" -email "${email}" +echo ${email} +echo ${fullname} + + +# Other options include +# -assetTag The Asset Tag of the computer +# -position The Position (Job Title) of the primary user +# -building The text representation of a Building in the JSS +# -department The text representation of a Department in the JSS +# -phone The Phone number of the primary user +# -room The Room that the computer is in + + + + +# # OLD METHOD BELOW THIS LINE # # + +# Open a dialog window asking for the email address of the user and assign to the UserID variable +# UserID=$(osascript -e 'display dialog "Please enter the email address for the person who will be using this computer" with title "Computer Assignment Question 1 of 2" default answer "@berkshireifa.com" buttons {"Next"} default button 1' | cut -f3 -d":") + +# Open a dialog window asking for the Full Name of the user and assign to the realName variable +# realName=$(osascript -e 'display dialog "Please enter the full name for the person who will be using this computer" with title "Computer Assignment Question 2 of 2" default answer "Firstname Lastname" buttons {"Next"} default button 1' | cut -f3 -d":") # Use jamf recon to set the UserID variable to the endUsername [Assigned User] parameter, also send the Full Name and Email Address # jamf recon -endUsername "${UserID}" -realname "${realName}" -email "${UserID}"