mirror of
https://github.com/PurpleComputing/mdmscripts.git
synced 2026-02-03 14:13:27 +00:00
Merge branch 'main' of https://github.com/PurpleComputing/mdmscripts
This commit is contained in:
BIN
Helpers/Pashua.zip
Normal file
BIN
Helpers/Pashua.zip
Normal file
Binary file not shown.
12
README.md
12
README.md
@@ -357,3 +357,15 @@ This script is designed to silently install/update balenaEtcher to an MDM enroll
|
||||
```
|
||||
sudo curl -o /tmp/balenaEtcher.sh https://raw.githubusercontent.com/PurpleComputing/mdmscripts/main/balenaEtcher.sh && sudo chmod +x /tmp/balenaEtcher.sh && sudo /tmp/balenaEtcher.sh [options]
|
||||
```
|
||||
|
||||
## computer-assignment.sh
|
||||
|
||||
### Assign User to Computer in JAMF
|
||||
|
||||
This script is designed to prompt the user for information to assist in the assignment process to an MDM enrolled Mac.
|
||||
|
||||
#### Command to execute
|
||||
|
||||
```
|
||||
sudo curl -o /tmp/computer-assignment.sh https://raw.githubusercontent.com/PurpleComputing/mdmscripts/main/computer-assignment.sh && sudo chmod +x /tmp/computer-assignment.sh && sudo /tmp/computer-assignment.sh [options]
|
||||
```
|
||||
|
||||
80
computer-assignment.sh
Normal file
80
computer-assignment.sh
Normal file
@@ -0,0 +1,80 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Set Pashua config location
|
||||
PashuaConfig=/tmp/Pashua.config
|
||||
|
||||
# Download Pashua from our repo.
|
||||
curl -o /tmp/Pashua.zip https://raw.githubusercontent.com/PurpleComputing/mdmscripts/main/Helpers/Pashua.zip
|
||||
|
||||
# Extract Pashua
|
||||
cd /tmp
|
||||
unzip Pashua.zip
|
||||
|
||||
# Remove any legacy Pashua.config files
|
||||
rm -rf /tmp/Pashua.config
|
||||
|
||||
# Create Pashua config file
|
||||
echo "*.title=Gathering User Info" >> $PashuaConfig
|
||||
echo "*.autoclosetime = 1800" >> $PashuaConfig
|
||||
echo "*.floating = 1" >> $PashuaConfig
|
||||
echo "fullname.type = textfield" >> $PashuaConfig
|
||||
echo "fullname.label = Enter your full name" >> $PashuaConfig
|
||||
echo "fullname.default = Firstname Lastname" >> $PashuaConfig
|
||||
echo "fullname.width = 340" >> $PashuaConfig
|
||||
echo "email.type = textfield" >> $PashuaConfig
|
||||
echo "email.label = Enter your email address" >> $PashuaConfig
|
||||
echo "email.default = name@domain.com" >> $PashuaConfig
|
||||
echo "email.width = 340" >> $PashuaConfig
|
||||
|
||||
# Launch Pashua to gather the info
|
||||
|
||||
result=`/tmp/Pashua.app/Contents/MacOS/Pashua $PashuaConfig | sed 's/ /;;;/g'`
|
||||
|
||||
# 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
|
||||
|
||||
jamf recon -endUsername "${email}" -realname "${fullname}" -email "${email}"
|
||||
|
||||
# Cleanup tmp files
|
||||
|
||||
rm -rf /tmp/Pashua.app
|
||||
rm -rf /tmp/Pashua.zip
|
||||
rm -rf /tmp/Pashua.config
|
||||
rm -rf $0
|
||||
|
||||
# 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}"
|
||||
|
||||
# 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
|
||||
Reference in New Issue
Block a user