├── .gitignore ├── README.md ├── Git ├── Git_EA.sh └── Git_Version_EA.sh ├── AutoPkg ├── AutoPkg_EA.sh ├── AutoPkg_Config.sh ├── AutoPkg_Version_EA.sh ├── AutoPkg_Repos_EA.sh └── AutoPkg_Run.sh ├── File_Rename ├── remove_trailing_period.sh ├── remove_leading_space.sh ├── remove_trailing_space.sh └── remove_special_characters.sh ├── Power_Nap ├── Disable_Power_Nap_EA.sh └── Disable_Power_Nap.sh ├── Computer_Info ├── EA_for_Computer_Info.sh ├── Set_Host_Name_From_Computer_Info.sh └── Index_Computer_Info.sh ├── Find_My_Mac ├── Find_My_Mac_EA.sh └── Find_My_Mac_Disable.sh ├── vmip ├── Printers ├── Printer_Option.sh └── Printer_Install.sh ├── FileVault └── Disable_FDEAutoLogin.sh ├── macOS_Auto_Updates ├── Configuration Profile │ ├── com.apple.commerce.plist │ └── com.apple.SoftwareUpdate.plist ├── Script + Extension Attributes │ ├── macOS_AutoUpdate_EA.sh │ ├── macOS_AutoUpdateRestartRequired_EA.sh │ ├── macOS_AutomaticDownload_EA.sh │ ├── macOS_ConfigDataInstall_EA.sh │ ├── macOS_AutomaticCheckEnabled_EA.sh │ ├── macOS_CriticalUpdateInstall_EA.sh │ └── macOS_Configure_Auto_Updates.sh └── README.md ├── DEPNotify ├── DEPStatus.sh ├── README.md ├── DEPStop.sh └── DEPStart.sh ├── Enable_Auto_Proxy.sh ├── Update_Username_in_JSS.sh ├── removeDaylite.sh ├── Unenroll_macOS.sh ├── Set_Time_Server.sh ├── betterUpdate.sh ├── Reenroll_macOS.sh ├── RenameMacUserNameAndHomeDirectory.sh ├── adduser.sh ├── Mobile_To_Local_Home_Folder.sh ├── install_SoftwareUpdates_AlwaysRestart.sh └── LICENSE.txt /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # This project has been moved to GitLab 2 | https://gitlab.com/ClassmateTeam/macOS_scripts 3 | -------------------------------------------------------------------------------- /Git/Git_EA.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -x "/usr/local/bin/git" ]; then 4 | echo "found" 5 | else 6 | echo "missing" 7 | fi 8 | exit 0 9 | -------------------------------------------------------------------------------- /AutoPkg/AutoPkg_EA.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -x "/usr/local/bin/autopkg" ]; then 4 | echo "found" 5 | else 6 | echo "missing" 7 | fi 8 | exit 0 9 | -------------------------------------------------------------------------------- /File_Rename/remove_trailing_period.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | IFS=$'\n' 3 | find . -name '*.' -depth | while read f; do 4 | mv "$f" "$(dirname "$f")/$(basename "$f" | sed 's/.$//')" 5 | done 6 | -------------------------------------------------------------------------------- /File_Rename/remove_leading_space.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | IFS=$'\n' 3 | find . -name ' *' -depth | while read f; do 4 | mv "$f" "$(dirname "$f")/$(basename "$f" | sed 's/^ *//;s/ *$//')" 5 | done 6 | -------------------------------------------------------------------------------- /File_Rename/remove_trailing_space.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | IFS=$'\n' 3 | find . -name '* ' -depth | while read f; do 4 | mv "$f" "$(dirname "$f")/$(basename "$f" | sed 's/^ *//;s/ *$//')" 5 | done 6 | -------------------------------------------------------------------------------- /Git/Git_Version_EA.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | result=$(/usr/local/bin/git version | awk {'print $3'}) 4 | if [ -x "/usr/local/bin/git" ]; then 5 | echo "$result" 6 | fi 7 | exit 0 8 | -------------------------------------------------------------------------------- /AutoPkg/AutoPkg_Config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | localAdminUser=example 4 | 5 | cd /Users/$localAdminUser && sudo -H -u $localAdminUser /usr/local/bin/autopkg repo-add https://github.com/autopkg/recipes.git 6 | -------------------------------------------------------------------------------- /Power_Nap/Disable_Power_Nap_EA.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | result=$(pmset -g | grep darkwakes | awk '{print $2}') 3 | if [ "$result" == "0" ]; then 4 | result="off" 5 | else 6 | result="on" 7 | fi 8 | echo "$result" 9 | -------------------------------------------------------------------------------- /AutoPkg/AutoPkg_Version_EA.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | localAdminUser=example 4 | 5 | result=$(sudo -H -u $localAdminUser /usr/local/bin/autopkg version) 6 | if [ -x "/usr/local/bin/autopkg" ]; then 7 | echo "$result" 8 | fi 9 | exit 0 10 | -------------------------------------------------------------------------------- /Computer_Info/EA_for_Computer_Info.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | result=$(ls -al /Library/ironsystems/ | grep info | awk '{print $9}') 3 | if [ "$result" == "info.plist" ]; then 4 | result="found" 5 | else 6 | result="missing" 7 | fi 8 | echo "$result" 9 | -------------------------------------------------------------------------------- /Find_My_Mac/Find_My_Mac_EA.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | result=$(nvram -p | grep -c 'fmm-mobileme-token-FMM') 4 | 5 | if [ $result -eq 0 ]; then 6 | $result="Not Enabled" 7 | else 8 | $result="Enabled" 9 | fi 10 | 11 | echo "$result" 12 | exit 0 13 | -------------------------------------------------------------------------------- /AutoPkg/AutoPkg_Repos_EA.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | localAdminUser=example 4 | 5 | result=$(sudo -H -u $localAdminUser /usr/local/bin/autopkg repo-list | awk {'print $2'}) 6 | if [ -x "/usr/local/bin/autopkg" ]; then 7 | echo "$result" 8 | fi 9 | exit 0 10 | -------------------------------------------------------------------------------- /Find_My_Mac/Find_My_Mac_Disable.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Remove Find My Mac token from nvram 3 | /usr/sbin/nvram -d fmm-mobileme-token-FMM 4 | if [ $? == 0 ]; then 5 | echo "Find My Mac token removed" 6 | exit 0 7 | else 8 | echo "Error removing Find My Mac token" 9 | exit 1 10 | fi 11 | -------------------------------------------------------------------------------- /Power_Nap/Disable_Power_Nap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Disable PowerName 4 | 5 | pwrnap=$(pmset -g | grep darkwakes | awk '{ print $2 }' 6 | if [ "$pwrnap" == "0" ]; then 7 | echo "PowerNap already disabled" 8 | else 9 | pmset -a darkwakes 0 10 | echo "PowerNap now disabled" 11 | fi 12 | -------------------------------------------------------------------------------- /vmip: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | vmwareApp="/Applications/VMware Fusion.app" 4 | 5 | runningVM=$("$vmwareApp"/Contents/Library/vmrun list | awk 'NR>1') 6 | 7 | for foundVM in "$runningVM" 8 | do 9 | vmIP=$("$vmwareApp"/Contents/Library/vmrun getGuestIPAddress "$foundVM") 10 | echo "$foundVM: $vmIP" 11 | done 12 | 13 | exit 0 14 | -------------------------------------------------------------------------------- /Printers/Printer_Option.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Jamf Pro variables 4 | ## $4 = Queue Name (no spaces) 5 | ## $5 = Option=Value (space separated) 6 | 7 | /usr/bin/lpoptions -p "$4" -E -o $5 8 | if [ "$?" == 0 ]; then 9 | echo "Printer configured correctly" 10 | exit 0 11 | else 12 | echo "Error occured: $?" 13 | exit 1 14 | fi 15 | -------------------------------------------------------------------------------- /FileVault/Disable_FDEAutoLogin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Disabling FileVaults Auto-login is the best option when utilizing 802.1(1)x's login screen configuration. Although the user must enter their password twice, it ensures internet access is acquired properly. 3 | 4 | sudo defaults write /Library/Preferences/com.apple.loginwindow DisableFDEAutoLogin -bool YES 5 | -------------------------------------------------------------------------------- /File_Rename/remove_special_characters.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | find . -depth -print0 | 3 | while IFS= read -d '' -r file; do 4 | dir=$(dirname "$file") 5 | base=$(basename "$file") 6 | base=${base//[^[:alnum:][:space:]-_,.\'()&\[\]]/_} 7 | newname="$dir/$base" 8 | if [[ ! -e $newname ]]; then 9 | mv "$file" "$newname" 10 | fi 11 | done 12 | -------------------------------------------------------------------------------- /macOS_Auto_Updates/Configuration Profile/com.apple.commerce.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AutoUpdate 6 | 7 | AutoUpdateRestartRequired 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Computer_Info/Set_Host_Name_From_Computer_Info.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #Read Name from info.plist 3 | name=$(defaults read /Library/ironsystems/info.plist Name) 4 | 5 | #Set ComputerName, HostName, LocalHostName 6 | scutil --set ComputerName "$name" 7 | scutil --set LocalHostName "$name" 8 | scutil --set HostName "$name".local 9 | 10 | #Create entry in hosts file 11 | echo '127.0.0.1' "$name".local >> /etc/hosts 12 | 13 | exit 0 14 | -------------------------------------------------------------------------------- /DEPNotify/DEPStatus.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #################### Variables #################### 3 | # Set $4 to "Status Update (Default: Installing something)" 4 | status_update="" 5 | ################## Do Not Modify ################## 6 | # Incase we don't specify anything 7 | if [[ $4 ]]; then 8 | status_update=$4 9 | elif [[ -z $status_update ]]; then 10 | status_update="Installing something" 11 | fi 12 | # Publish status update 13 | echo "Status: $status_update" >> /var/tmp/depnotify.log 14 | 15 | exit 0 16 | -------------------------------------------------------------------------------- /macOS_Auto_Updates/Configuration Profile/com.apple.SoftwareUpdate.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AllowPreReleaseInstallation 6 | 7 | AutomaticCheckEnabled 8 | 9 | AutomaticDownload 10 | 11 | ConfigDataInstall 12 | 13 | CriticalUpdateInstall 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /macOS_Auto_Updates/Script + Extension Attributes/macOS_AutoUpdate_EA.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # locate defaults binary 4 | defaults=$(which defaults) 5 | if [ ! -e "$defaults" ]; then 6 | echo "defaults binary not found" 7 | exit 1 8 | fi 9 | 10 | # com.apple.commerce 11 | result=$($defaults read /Library/Preferences/com.apple.commerce AutoUpdate) 12 | if [[ "$result" == 1 ]]; then 13 | result=Enabled 14 | elif [[ "$result" == 0 ]]; then 15 | result=Disabled 16 | else 17 | result=Missing 18 | fi 19 | echo "$result" 20 | exit 0 21 | -------------------------------------------------------------------------------- /macOS_Auto_Updates/Script + Extension Attributes/macOS_AutoUpdateRestartRequired_EA.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # locate defaults binary 4 | defaults=$(which defaults) 5 | if [ ! -e "$defaults" ]; then 6 | echo "defaults binary not found" 7 | exit 1 8 | fi 9 | 10 | # com.apple.commerce 11 | result=$($defaults read /Library/Preferences/com.apple.commerce AutoUpdateRestartRequired) 12 | if [[ "$result" == 1 ]]; then 13 | result=Enabled 14 | elif [[ "$result" == 0 ]]; then 15 | result=Disabled 16 | else 17 | result=Missing 18 | fi 19 | echo "$result" 20 | exit 0 21 | -------------------------------------------------------------------------------- /macOS_Auto_Updates/Script + Extension Attributes/macOS_AutomaticDownload_EA.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # locate defaults binary 4 | defaults=$(which defaults) 5 | if [ ! -e "$defaults" ]; then 6 | echo "defaults binary not found" 7 | exit 1 8 | fi 9 | 10 | # com.apple.SoftwareUpdate 11 | result=$($defaults read /Library/Preferences/com.apple.SoftwareUpdate AutomaticDownload) 12 | if [[ "$result" == 1 ]]; then 13 | result=Enabled 14 | elif [[ "$result" == 0 ]]; then 15 | result=Disabled 16 | else 17 | result=Missing 18 | fi 19 | echo "$result" 20 | exit 0 21 | -------------------------------------------------------------------------------- /macOS_Auto_Updates/Script + Extension Attributes/macOS_ConfigDataInstall_EA.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # locate defaults binary 4 | defaults=$(which defaults) 5 | if [ ! -e "$defaults" ]; then 6 | echo "defaults binary not found" 7 | exit 1 8 | fi 9 | 10 | # com.apple.SoftwareUpdate 11 | result=$($defaults read /Library/Preferences/com.apple.SoftwareUpdate ConfigDataInstall) 12 | if [[ "$result" == 1 ]]; then 13 | result=Enabled 14 | elif [[ "$result" == 0 ]]; then 15 | result=Disabled 16 | else 17 | result=Missing 18 | fi 19 | echo "$result" 20 | exit 0 21 | -------------------------------------------------------------------------------- /Printers/Printer_Install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Jamf Pro variables 3 | ## $4 = Queue Name (no spaces) 4 | ## $5 = Friendly Name 5 | ## $6 = Location 6 | ## $7 = IP Address 7 | ## $8 = Driver Location 8 | ## $9 = Protocol (Default: ipp://) 9 | 10 | if [[ $9 ]]; then 11 | protocol="$9" 12 | else 13 | protocol="ipp://" 14 | fi 15 | 16 | /usr/sbin/lpadmin -p "$4" -D "$5" -L "$6" -E -o printer-is-shared=false -v $protocol$7 -P "$8" 17 | if [ "$?" == 0 ]; then 18 | echo "Printer configured correctly" 19 | exit 0 20 | else 21 | echo "Error occured: $?" 22 | exit 1 23 | fi 24 | -------------------------------------------------------------------------------- /macOS_Auto_Updates/Script + Extension Attributes/macOS_AutomaticCheckEnabled_EA.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # locate defaults binary 4 | defaults=$(which defaults) 5 | if [ ! -e "$defaults" ]; then 6 | echo "defaults binary not found" 7 | exit 1 8 | fi 9 | 10 | # com.apple.SoftwareUpdate 11 | result=$($defaults read /Library/Preferences/com.apple.SoftwareUpdate AutomaticCheckEnabled) 12 | if [[ "$result" == 1 ]]; then 13 | result=Enabled 14 | elif [[ "$result" == 0 ]]; then 15 | result=Disabled 16 | else 17 | result=Missing 18 | fi 19 | echo "$result" 20 | exit 0 21 | -------------------------------------------------------------------------------- /macOS_Auto_Updates/Script + Extension Attributes/macOS_CriticalUpdateInstall_EA.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # locate defaults binary 4 | defaults=$(which defaults) 5 | if [ ! -e "$defaults" ]; then 6 | echo "defaults binary not found" 7 | exit 1 8 | fi 9 | 10 | # com.apple.SoftwareUpdate 11 | result=$($defaults read /Library/Preferences/com.apple.SoftwareUpdate CriticalUpdateInstall) 12 | if [[ "$result" == 1 ]]; then 13 | result=Enabled 14 | elif [[ "$result" == 0 ]]; then 15 | result=Disabled 16 | else 17 | result=Missing 18 | fi 19 | echo "$result" 20 | exit 0 21 | -------------------------------------------------------------------------------- /AutoPkg/AutoPkg_Run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Set parameter 4 to "Recipe(s) to Run. Separated by spaces." 3 | 4 | localAdminUser=example 5 | 6 | if [ ! -x /usr/local/bin/autopkg ]; then 7 | echo "AutoPkg binary not found" 8 | exit 1 9 | fi 10 | 11 | cd /Users/$localAdminUser/ && sudo -H -u $localAdminUser /usr/local/bin/autopkg repo-update all 12 | if [ $? != 0 ]; then 13 | echo "failed to update repos" 14 | exit 1 15 | fi 16 | 17 | cd /Users/$localAdminUser/ && sudo -H -u $localAdminUser /usr/local/bin/autopkg run $4 18 | if [ $? != 0 ]; then 19 | echo "failed to run $4" 20 | exit 1 21 | fi 22 | -------------------------------------------------------------------------------- /Enable_Auto_Proxy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | tbeth=$(networksetup -listallnetworkservices | grep 'Thunderbolt Ethernet') 4 | usbeth=$(networksetup -listallnetworkservices | grep 'USB Ethernet') 5 | wifi=$(networksetup -listallnetworkservices | grep 'Wi-Fi') 6 | 7 | if [ "$tbeth" == "Thunderbolt Ethernet" ]; then 8 | networksetup -setproxyautodiscovery 'Thunderbolt Ethernet' on 9 | else 10 | echo "Thunderbolt Ethernet not connected" 11 | fi 12 | 13 | if [ "$usbeth" == "USB Ethernet" ]; then 14 | networksetup -setproxyautodiscovery 'USB Ethernet' on 15 | else 16 | echo "USB Ethernet not connected" 17 | fi 18 | 19 | if [ "$wifi" == "Wi-Fi" ]; then 20 | networksetup -setproxyautodiscovery 'Wi-Fi' on 21 | else 22 | echo "Wi-Fi not connected" 23 | fi 24 | 25 | exit 0 26 | -------------------------------------------------------------------------------- /Update_Username_in_JSS.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ################################################################################ 3 | ## Script Author: Jon Yergatian 4 | ## Last Update: 2016-07-21 5 | ############################### Variables ###################################### 6 | # The local admin account that should be ignored (not reported to JSS) 7 | localAdmin=example 8 | ############################# Do Not Modify #################################### 9 | 10 | # Get the current user's username 11 | currentUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'` 12 | 13 | if [[ "$currentUser" == "$localAdmin" || "$currentUser" == "root" ]]; then 14 | echo "User: $currentUser intentionally ignored" 15 | exit 10 16 | else 17 | echo "Submitting Username: $currentUser to JSS" 18 | jamf recon -endUsername $currentUser 19 | echo "Username: $currentUser submitted" 20 | exit 0 21 | fi 22 | -------------------------------------------------------------------------------- /removeDaylite.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Look for and remove Daylite 3 3 | if [ -e /Applications/Daylite\ 3/ ]; then 4 | echo "Daylite 3 found" 5 | rm -rf /Applications/Daylite\ 3/ 6 | if [ "$?" == 0 ]; then 7 | echo "Daylite 3 removed" 8 | fi 9 | else 10 | echo "Daylite 3 not found" 11 | fi 12 | # Look for and remove Daylite 4 & 5 13 | if [ -e /Applications/Daylite.app ]; then 14 | dayliteVersion=`defaults read /Applications/Daylite.app/Contents/Info.plist CFBundleShortVersionString` 15 | if [[ "$dayliteVersion" == 4.* ]] || [[ "$dayliteVersion" == 5.* ]]; then 16 | echo "Daylite 4 or 5 found" 17 | rm -rf /Applications/Daylite.app 18 | if [ "$?" == 0 ]; then 19 | echo "Daylite 4 or 5 removed" 20 | fi 21 | elif [[ "$dayliteVersion" == 6.* ]]; then 22 | echo "Daylite 6 found" 23 | fi 24 | else 25 | echo "Daylite 4, 5, or 6 not found" 26 | fi 27 | exit 0 28 | -------------------------------------------------------------------------------- /Computer_Info/Index_Computer_Info.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #Grab info from System_Profiler 3 | model=$(system_profiler SPHardwareDataType | grep "Model Identifier" | awk '{print $3}') 4 | serial=$(system_profiler SPHardwareDataType | awk '/Serial\ Number\ \(system\)/ {print $NF}') 5 | 6 | #Define Name prefix based on model 7 | if [[ "$model" = MacBookPro* ]]; then 8 | prefix="MBP-" 9 | elif [[ "$model" = MacBookAir* ]]; then 10 | prefix="MBA-" 11 | elif [[ "$model" = MacPro* ]]; then 12 | prefix="MP-" 13 | elif [[ "$model" = iMac* ]]; then 14 | prefix="iM-" 15 | elif [[ "$model" = MacBook* ]]; then 16 | prefix="MB-" 17 | elif [[ "$model" = MacMini* ]]; then 18 | prefix="MM-" 19 | else 20 | prefix="M-" 21 | fi 22 | 23 | #Create and write to info.plist 24 | touch /Library/ironsystems/info.plist 25 | defaults write /Library/ironsystems/info.plist Model -string "$model" 26 | defaults write /Library/ironsystems/info.plist SerialNumber -string "$serial" 27 | defaults write /Library/ironsystems/info.plist Name -string "$prefix""$serial" 28 | 29 | exit 0 30 | -------------------------------------------------------------------------------- /macOS_Auto_Updates/Script + Extension Attributes/macOS_Configure_Auto_Updates.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # locate defaults binary 4 | defaults=$(which defaults) 5 | if [ ! -e "$defaults" ]; then 6 | echo "defaults binary not found" 7 | exit 1 8 | fi 9 | 10 | # com.apple.commerce 11 | $defaults write /Library/Preferences/com.apple.commerce AutoUpdate -bool TRUE 12 | echo "Enabled AutoUpdate" 13 | $defaults write /Library/Preferences/com.apple.commerce AutoUpdateRestartRequired -bool TRUE 14 | echo "Enabled AutoUpdateRestartRequired" 15 | 16 | # com.apple.SoftwareUpdate 17 | $defaults write /Library/Preferences/com.apple.SoftwareUpdate AutomaticCheckEnabled -bool TRUE 18 | echo "Enabled AutomaticCheckEnabled" 19 | $defaults write /Library/Preferences/com.apple.SoftwareUpdate AutomaticDownload -bool TRUE 20 | echo "Enabled AutomaticDownload" 21 | $defaults write /Library/Preferences/com.apple.SoftwareUpdate CriticalUpdateInstall -bool TRUE 22 | echo "Enabled CriticalUpdateInstall" 23 | $defaults write /Library/Preferences/com.apple.SoftwareUpdate ConfigDataInstall -bool TRUE 24 | echo "Enabled ConfigDataInstall" 25 | 26 | exit 0 27 | -------------------------------------------------------------------------------- /Unenroll_macOS.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #################################################### 3 | ## Set $4 to SSID 4 | ## Set $5 to SSID Password 5 | #################################################### 6 | # Find Wi-Fi interface 7 | wifiInterface=$(/usr/sbin/networksetup -listallhardwareports | awk '/^Hardware Port: (Wi-Fi|AirPort)/,/^Device/' | tail -1 | cut -c 9-) 8 | 9 | # Find current Wi-Fi network 10 | currentWifi=$(/usr/sbin/networksetup -getairportnetwork "$wifiInterface" | cut -c 24-) 11 | 12 | # Function to remove MDM 13 | removeMDM() { 14 | /bin/rm -rf /Library/Keychains/apsd.keychain 15 | /bin/rm -rf /var/db/ConfigurationProfiles 16 | /bin/echo y | /usr/bin/profiles -D 17 | } 18 | 19 | # Ensure jamf binary is ready 20 | jamfCLIPath=/usr/local/jamf/bin/jamf 21 | /usr/sbin/chown 0:0 $jamfCLIPath 22 | /bin/chmod 551 $jamfCLIPath 23 | 24 | if [ "$currentWifi" == "$4" ]; then 25 | # Remove old profiles 26 | removeMDM 27 | /bin/sleep 3 28 | # Join Wi-Fi network 29 | /usr/sbin/networksetup -setairportnetwork "$wifiInterface" "$4" "$5" 30 | else 31 | # Remove old profiles 32 | removeMDM 33 | fi 34 | 35 | # Remove framework 36 | $jamfCLIPath removeFramework 37 | 38 | # Exit 39 | exit 0 40 | -------------------------------------------------------------------------------- /macOS_Auto_Updates/README.md: -------------------------------------------------------------------------------- 1 | # Contents 2 | ## Configuration Profile 3 | Deploy these two plists using the **Custom Settings** payload within your MDM. These will enable the following and force those in bold: 4 | 5 | * **Automatically check for updates** 6 | * **Download newly available updates in the background** 7 | * Install app updates 8 | * Install macOS updates 9 | * **Install system data files and security updates** 10 | 11 | ## Script + Extension Attributes 12 | `macOS_Configure_Auto_Updates.sh` will enable all available Automatic Update options within macOS. Each Extension Attribute (EA) script will monitor and report the status of each option. 13 | 14 | ### Smart Group Criteria 15 | ( **AutoUpdate** *is not* **Enabled** 16 | or **AutomaticCheckEnabled** *is not* **Enabled** 17 | or **AutomaticDownload** *is not* **Enabled** 18 | or **AutoUpdateRestartRequired** *is not* **Enabled** 19 | or **CriticalUpdateInstall** *is not* **Enabled** 20 | or **ConfigDataInstall** *is not* **Enabled** ) 21 | 22 | ### Policy Configuration 23 | **Trigger** = Recurring Check-in & Enrollment Complete 24 | **Script** = Configure_macOS_Auto_Updates.sh 25 | **Maintenance** = Update Inventory 26 | **Scope** = Smart Group with above criteria 27 | -------------------------------------------------------------------------------- /Set_Time_Server.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | primaryts="timeserver.local" 4 | secondaryts="pool.ntp.org" 5 | 6 | #Turn off NetworkTime before modifying settings 7 | /usr/sbin/systemsetup -setusingnetworktime off 8 | 9 | #Set specific time server 10 | /usr/sbin/systemsetup -setnetworktimeserver $primaryts 11 | 12 | # Set time zone automatically using current location 13 | /bin/echo "set time zone automatically using current location" 14 | # enable location services 15 | /bin/launchctl unload /System/Library/LaunchDaemons/com.apple.locationd.plist 16 | uuid=`/usr/sbin/system_profiler SPHardwareDataType | grep "Hardware UUID" | cut -c22-57` 17 | /usr/bin/defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd.$uuid LocationServicesEnabled -int 1 18 | /usr/sbin/chown -R _locationd:_locationd /var/db/locationd 19 | /bin/launchctl load /System/Library/LaunchDaemons/com.apple.locationd.plist 20 | # set time zone automatically using current location 21 | /usr/bin/defaults write /Library/Preferences/com.apple.timezone.auto Active -bool true 22 | 23 | #Turn on NetworkTime with new settings 24 | /usr/sbin/systemsetup -setusingnetworktime on 25 | 26 | #Add external TimeServer 27 | /bin/echo "adding external time server" 28 | /bin/echo server $secondaryts >> /private/etc/ntp.conf 29 | 30 | exit 0 31 | -------------------------------------------------------------------------------- /betterUpdate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ########################## Variables ########################## 3 | jamfHelper='/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper' 4 | applicationTitle="$4" 5 | processNames="$5" 6 | customTrigger="$6" 7 | IFS="," 8 | title="IT Alerts" 9 | icon="/path/to/icon.png" 10 | heading1="Update ${applicationTitle}" 11 | description1="needs to quit before ${applicationTitle} can be updated. 12 | 13 | Click Continue to quit." 14 | ######################### Do Not Edit ######################### 15 | # Prompts user with jamfHelper when called 16 | function promptUser() 17 | { 18 | promptResult="" 19 | promptResult=$($jamfHelper -lockHUD -windowType utility -icon "$icon" -title "$title" -heading "$1" -alignHeading center -description "$3 $2" -button1 Continue -button2 Cancel -defaultButton 1) 20 | } 21 | # Check to see if any specified process is running, prompt user to quit if yes 22 | for process in $processNames 23 | do 24 | PID="" 25 | PID=`pgrep "$process"` 26 | if [ ! -z "$PID" ]; then 27 | promptUser "$heading1" "$description1" "$process" 28 | if [[ $promptResult = 0 ]]; then 29 | killall "$process" 30 | elif [[ $promptResult = 2 ]]; then 31 | echo "User clicked Cancel" 32 | exit 1 33 | fi 34 | fi 35 | done 36 | # Initiate install using custom trigger from policy 37 | jamf policy -event $customTrigger 38 | # clean exit 39 | exit 0 40 | 41 | -------------------------------------------------------------------------------- /Reenroll_macOS.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #################################################### 3 | ## Set $4 to Jamf Pro URL 4 | ## Set $5 to Enroll Invitation Code 5 | ## Set $6 to SSID 6 | ## Set $7 to SSID Password 7 | #################################################### 8 | # Find Wi-Fi interface 9 | wifiInterface=$(/usr/sbin/networksetup -listallhardwareports | awk '/^Hardware Port: (Wi-Fi|AirPort)/,/^Device/' | tail -1 | cut -c 9-) 10 | 11 | # Find current Wi-Fi network 12 | currentWifi=$(/usr/sbin/networksetup -getairportnetwork "$wifiInterface" | cut -c 24-) 13 | 14 | # Function to remove MDM 15 | removeMDM() { 16 | /bin/rm -rf /Library/Keychains/apsd.keychain 17 | /bin/rm -rf /var/db/ConfigurationProfiles 18 | /bin/echo y | /usr/bin/profiles -D 19 | } 20 | 21 | # Ensure jamf binary is ready 22 | jamfCLIPath=/usr/local/jamf/bin/jamf 23 | /usr/sbin/chown 0:0 $jamfCLIPath 24 | /bin/chmod 551 $jamfCLIPath 25 | 26 | if [ "$currentWifi" == "$6" ]; then 27 | # Remove old profiles 28 | removeMDM 29 | /bin/sleep 3 30 | # Join Wi-Fi network 31 | /usr/sbin/networksetup -setairportnetwork "$wifiInterface" "$6" "$7" 32 | else 33 | # Remove old profiles 34 | removeMDM 35 | fi 36 | 37 | # Create the configuration file at /Library/Preferences/com.jamfsoftware.jamf.plist 38 | $jamfCLIPath createConf -url $4 39 | 40 | # Turn on SSH 41 | $jamfCLIPath startSSH 42 | 43 | # Run enroll 44 | $jamfCLIPath enroll -invitation $5 -noPolicy 45 | enrolled=$? 46 | if [ $enrolled -eq 0 ] 47 | then 48 | $jamfCLIPath update 49 | $jamfCLIPath mdm 50 | $jamfCLIPath policy -event enrollmentComplete 51 | enrolled=$? 52 | fi 53 | 54 | # Exit 55 | exit $enrolled 56 | -------------------------------------------------------------------------------- /RenameMacUserNameAndHomeDirectory.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Script to rename the user name of a user on OS X 5 | # 6 | # The script updates the users record name and home directory 7 | # name from an old name to a new one. 8 | # 9 | # NOTE: MUST BE RUN AS ROOT! 10 | # 11 | abort() { 12 | errString=${*} 13 | echo "$errString" 14 | exit 1 15 | } 16 | 17 | if [[ ${#} -ne 2 ]] 18 | then 19 | echo "Usage: $0 oldUserName newUserName" 20 | exit 1 21 | fi 22 | 23 | oldUser=$1 24 | newUser=$2 25 | 26 | if [[ -z "${newUser}" ]] 27 | then 28 | abort "New user name must not be empty!" 29 | fi 30 | 31 | origHomeDir=`dscl . -read /Users/${oldUser} NFSHomeDirectory | awk '{print $2}' -` 32 | 33 | if [[ -z "${origHomeDir}" ]] 34 | then 35 | abort "Cannot obtain the original home directory name, is the oldUserName correct?" 36 | fi 37 | 38 | dscl . -change /Users/${oldUser} NFSHomeDirectory /Users/${oldUser} /Users/${newUser} 39 | err=$? 40 | if [ ${err} -ne 0 ] 41 | then 42 | abort "Could not rename the user's home directory pointer, aborting further changes! - err=${err}" 43 | fi 44 | 45 | mv /Users/${oldUser} /Users/${newUser} 46 | err=$? 47 | if [[ ${err} -ne 0 ]] 48 | then 49 | abort "Could not rename the user's home directory in /Users - the user may not be able to login unless you correct dscl to point back to /Users/${oldUser}" 50 | fi 51 | 52 | dscl . -change /Users/${oldUser} RecordName ${oldUser} ${newUser} 53 | err=$? 54 | if [[ ${err} -ne 0 ]] 55 | then 56 | abort "Could not rename the user's RecordName in dscl - the user should still be able to login, but with user name ${oldUser}, however, their home directory will be pointed to /Users/${newUser}" 57 | fi 58 | 59 | echo "SUCCESS: ${oldUser} --> ${newUser}" 60 | 61 | exit 0 62 | -------------------------------------------------------------------------------- /DEPNotify/README.md: -------------------------------------------------------------------------------- 1 | **Note:** 2 | >*These scripts were written for maximum compatibility with Jamf Pro but should work with any deployment framework.* 3 | 4 | # Scripts 5 | 6 | ## DEPStart.sh 7 | Deploy as early in the deployment process as possible. This will set the stage for DEPNotify.app and then open the application. 8 | #### Variables 9 | ``` 10 | # Unique Launch Agent identifier 11 | org_identifier="com.depnotify" 12 | 13 | # Set $4 to "DEPNotify Path (Default: /Applications/DEPNotify.app)" 14 | depnotify_path="" 15 | 16 | # Set $5 to "Support Link (Default: None)" 17 | support_link="" 18 | 19 | # Set $6 to "Image Path (Default: None)" 20 | image_path="" 21 | 22 | # Set $7 to "Welcome Message (Default: Welcome to your new Mac!)" 23 | welcome_message="" 24 | 25 | # Set $8 to "Window Title (Default: Hello!)" 26 | window_title="" 27 | 28 | # Set $9 to "Intro Status (Default: Running automated setup)" 29 | intro_status="" 30 | ``` 31 | 32 | ## DEPStatus.sh 33 | While optional, this script is what makes DEPNotify.app so great. Attach this script to the payload of any policy you'd like to notify your users of. I'd recommend having this script run *before* other items in the payload. 34 | #### Variables 35 | ``` 36 | # Set $4 to "Status Update (Default: Installing something)" 37 | status_update="" 38 | ``` 39 | 40 | ## DEPStop.sh 41 | This will close DEPNotify.app and, optionally, logout or quit with/without a message to the user. This should should run as late as possible in the deployment process. 42 | #### Variables 43 | ``` 44 | # Unique Launch Agent identifier 45 | org_identifier="com.depnotify" 46 | 47 | # Set $4 to "Quitting Message (Default: None)" 48 | quitting_message="" 49 | 50 | # Set $5 to "Open Self Service (Default: False)" 51 | open_self_service="" 52 | 53 | # Set $6 to "Self Service Path (Default: /Applications/Self Service.app)" 54 | self_service_path="" 55 | 56 | # Set $7 to "Ask for Logout (Default: False)" 57 | ask_logout="" 58 | 59 | # Set $8 to "Logout Message (Default: Please logout to enable FileVault.)" 60 | logout_message="" 61 | 62 | # Set $9 to "Force Logout (Default: False)" 63 | force_logout="" 64 | ``` 65 | -------------------------------------------------------------------------------- /DEPNotify/DEPStop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #################### Variables #################### 3 | # Unique Launch Agent identifier 4 | org_identifier="com.depnotify" 5 | # Set $4 to "Quitting Message (Default: None)" 6 | quitting_message="" 7 | # Set $5 to "Open Self Service (Default: False)" 8 | open_self_service="" 9 | # Set $6 to "Self Service Path (Default: /Applications/Self Service.app)" 10 | self_service_path="" 11 | # Set $7 to "Ask for Logout (Default: False)" 12 | ask_logout="" 13 | # Set $8 to "Logout Message (Default: Please logout to enable FileVault.)" 14 | logout_message="" 15 | # Set $9 to "Force Logout (Default: False)" 16 | force_logout="" 17 | ################## Do Not Modify ################## 18 | 19 | # Incase we don't specify anything 20 | if [[ $4 ]]; then 21 | quitting_message=$4 22 | fi 23 | if [[ $5 ]]; then 24 | open_self_service=$5 25 | fi 26 | if [[ $6 ]]; then 27 | self_service_path=$6 28 | elif [[ -z $self_service_path ]]; then 29 | self_service_path="/Applications/Self Service.app" 30 | fi 31 | if [[ $7 ]]; then 32 | ask_logout=$7 33 | fi 34 | if [[ $8 ]]; then 35 | logout_message=$8 36 | elif [[ -z $logout_message ]]; then 37 | logout_message="Please logout to enable FileVault" 38 | fi 39 | if [[ $9 ]]; then 40 | force_logout=$9 41 | fi 42 | # Main 43 | if [[ $force_logout ]]; then 44 | ## Force Logout 45 | echo "Command: LogoutNow:" >> /var/tmp/depnotify.log 46 | echo "Command: Quit" >> /var/tmp/depnotify.log 47 | ## Ask for Logout 48 | elif [[ $ask_logout ]]; then 49 | echo "Command: WindowStyle: Activate" >> /var/tmp/depnotify.log 50 | echo "Command: Logout: $logout_message" >> /var/tmp/depnotify.log 51 | else 52 | ## Quit 53 | if [[ $quitting_message ]]; then 54 | ### Quit with message 55 | echo "Command: WindowStyle: Activate" >> /var/tmp/depnotify.log 56 | echo "Command: Quit: $quitting_message" >> /var/tmp/depnotify.log 57 | else 58 | ### Quit without message 59 | echo "Command: Quit" >> /var/tmp/depnotify.log 60 | fi 61 | ## Open Self Service, if desired 62 | if [[ $open_self_service ]]; then 63 | open "$self_service_path" 64 | fi 65 | fi 66 | /bin/rm -f /Library/LaunchAgents/$org_identifier.plist 67 | exit 0 68 | -------------------------------------------------------------------------------- /adduser.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # create_user_1.2.sh 4 | # 5 | # 6 | # 7 | 8 | if [ "$(id -u)" != "0" ]; then 9 | echo "Sorry, you are not root. Please run with sudo!" 10 | exit 1 11 | fi 12 | 13 | 14 | # === For creating a User we need some input! === 15 | 16 | echo "Enter your desired user name: " 17 | read USERNAME 18 | 19 | echo "Enter a full name for this user: " 20 | read FULLNAME 21 | 22 | echo "Enter a password for this user: " 23 | read -s PASSWORD 24 | 25 | # ==== 26 | 27 | 28 | # A list of groups the user should belong to 29 | # This makes the difference between admin and non-admin users. 30 | 31 | echo "Is this an administrative user? (y/n)" 32 | read GROUP_ADD 33 | 34 | if [ "$GROUP_ADD" = n ] ; then 35 | SECONDARY_GROUPS="staff" # for a non-admin user 36 | elif [ "$GROUP_ADD" = y ] ; then 37 | SECONDARY_GROUPS="admin _lpadmin _appserveradm _appserverusr" # for an admin user 38 | else 39 | echo "Please make a selection!" 40 | fi 41 | 42 | # ==== 43 | 44 | # Create a UID that is not currently in use 45 | echo "Creating an unused UID for new user..." 46 | 47 | # Find out the next available user ID 48 | MAXID=$(dscl . -list /Users UniqueID | awk '{print $2}' | sort -ug | tail -1) 49 | USERID=$((MAXID+1)) 50 | 51 | # check the OS X Version 52 | OSXVERSION=$(sw_vers -productVersion | awk -F '.' '{print $1 "." $2}') 53 | 54 | #if osx 10.10 then run 55 | if [[ "$OSXVERSION" == "10.11" ]]; then 56 | echo "OS is 10.11" 57 | sysadminctl -addUser $USERNAME -fullName "$FULLNAME" -UID=$USERID -password $PASSWORD 58 | 59 | #if osx 10.10 then run 60 | 61 | elif [[ "$OSXVERSION" == "10.10" ]]; then 62 | echo "OS is 10.10" 63 | sysadminctl -addUser $USERNAME -fullName "$FULLNAME" -UID=$USERID -password $PASSWORD 64 | 65 | #if osx 10.9 then run 66 | 67 | elif [[ "$OSXVERSION" == "10.9" ]]; then 68 | 69 | # Create the user account by running dscl 70 | echo "Creating necessary files..." 71 | 72 | dscl . -create /Users/$USERNAME 73 | dscl . -create /Users/$USERNAME UserShell /bin/bash 74 | dscl . -create /Users/$USERNAME RealName "$FULLNAME" 75 | dscl . -create /Users/$USERNAME UniqueID "$USERID" 76 | dscl . -create /Users/$USERNAME PrimaryGroupID 20 77 | dscl . -create /Users/$USERNAME NFSHomeDirectory /Users/$USERNAME 78 | dscl . -passwd /Users/$USERNAME $PASSWORD 79 | 80 | # Create the home directory 81 | echo "Creating home directory..." 82 | createhomedir -c 2>&1 | grep -v "shell-init" 83 | 84 | fi 85 | 86 | # Add user to any specified groups 87 | echo "Adding user to specified groups..." 88 | 89 | for GROUP in $SECONDARY_GROUPS ; do 90 | dseditgroup -o edit -t user -a $USERNAME $GROUP 91 | done 92 | 93 | echo "Created user #$USERID: $USERNAME ($FULLNAME)" 94 | 95 | exit 0 96 | -------------------------------------------------------------------------------- /DEPNotify/DEPStart.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #################### Variables #################### 4 | # Unique Launch Agent identifier 5 | org_identifier="com.depnotify" 6 | # Set $4 to "DEPNotify Path (Default: /Applications/Utilities/DEPNotify.app)" 7 | depnotify_path="" 8 | # Set $5 to "Support Link (Default: None)" 9 | support_link="" 10 | # Set $6 to "Image Path (Default: None)" 11 | image_path="" 12 | # Set $7 to "Welcome Message (Default: Welcome to your new Mac!)" 13 | welcome_message="" 14 | # Set $8 to "Window Title (Default: Hello!)" 15 | window_title="" 16 | # Set $9 to "Intro Status (Default: Running automated setup)" 17 | intro_status="" 18 | ################## Do Not Modify ################## 19 | 20 | DATE=$(date "+%Y%m%d-%H%M%S") 21 | 22 | # Incase we didn't specify something 23 | ## Launch Agent identifier 24 | if [[ -z $org_identifier ]]; then 25 | echo "Missing Launch Agent identifier" 26 | exit 1 27 | fi 28 | ## DEPNotify Path 29 | if [[ $4 ]]; then 30 | depnotify_path=$4 31 | elif [[ -z $depnotify_path ]]; then 32 | depnotify_path="/Applications/Utilities/DEPNotify.app" 33 | fi 34 | ## Support Link 35 | if [[ $5 ]]; then 36 | support_link=$5 37 | fi 38 | ## Image Path 39 | if [[ $6 ]]; then 40 | image_path=$6 41 | fi 42 | ## Welcome Message 43 | if [[ $7 ]]; then 44 | welcome_message=$7 45 | elif [[ -z $welcome_message ]]; then 46 | welcome_message="Welcome to your new Mac!" 47 | fi 48 | ## Window Title 49 | if [[ $8 ]]; then 50 | window_title=$8 51 | elif [[ -z $window_title ]]; then 52 | window_title="Hello!" 53 | fi 54 | ## Intro Status 55 | if [[ $9 ]]; then 56 | intro_status=$9 57 | elif [[ -z $intro_status ]]; then 58 | intro_status="Running automated setup" 59 | fi 60 | 61 | # Install Launch Agent 62 | launch_agent=" 63 | 64 | 65 | 66 | Label 67 | $org_identifier 68 | ProgramArguments 69 | 70 | /usr/bin/open 71 | $depnotify_path 72 | 73 | RunAtLoad 74 | 75 | 76 | " 77 | 78 | # Backup existing depnotify.log 79 | if [ -r /var/tmp/depnotify.log ]; then 80 | cp /var/tmp/depnotify.log /var/tmp/depnotify.log.$DATE 81 | fi 82 | 83 | # Set the stage 84 | if [[ $support_link ]]; then 85 | echo "Command: Help: $support_link" > /var/tmp/depnotify.log 86 | fi 87 | if [[ $image_path ]]; then 88 | echo "Command: Image: $image_path" >> /var/tmp/depnotify.log 89 | fi 90 | echo "Command: MainText: $welcome_message" >> /var/tmp/depnotify.log 91 | echo "Command: WindowStyle: Activate" >> /var/tmp/depnotify.log 92 | echo "Command: WindowTitle: $window_title" >> /var/tmp/depnotify.log 93 | # Make sure it's readable 94 | chmod 644 /var/tmp/depnotify.log 95 | # Start the process 96 | echo "$launch_agent" > "/Library/LaunchAgents/$org_identifier.plist" 97 | uid=$(/usr/bin/stat -f %u /dev/console) 98 | if [ $uid -gt 500 ]; then 99 | /bin/launchctl asuser $uid /bin/launchctl load /Library/LaunchAgents/$org_identifier.plist 100 | fi 101 | # Announce new begginings 102 | echo "Status: $intro_status" >> /var/tmp/depnotify.log 103 | 104 | exit 0 105 | -------------------------------------------------------------------------------- /Mobile_To_Local_Home_Folder.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Recreate account.sh 4 | # 5 | # This script is designed to remove a mobile user account and re-create 6 | # a local account with the same username and the password from user-input. 7 | # It will also give read/write permissions to the user's home folder. 8 | 9 | #Gets the short name of the currently logged in user 10 | loggedInUser=$3 11 | 12 | #Get loggedInUser UID 13 | UserUID=`dscl . read /Users/"$loggedInUser" UniqueID | grep UniqueID: | cut -c 11-` 14 | 15 | #Exit if UID is under 1000 (local account) 16 | if [[ "$UserUID" -lt 1000 ]]; then 17 | echo "Not a mobile account, exiting" 18 | exit 2 19 | else 20 | 21 | #Gets the real name of the currently logged in user 22 | userRealName=`dscl . -read /Users/$loggedInUser | grep RealName: | cut -c11-` 23 | if [[ -z $userRealName ]]; then 24 | userRealName=`dscl . -read /Users/$loggedInUser | awk '/^RealName:/,/^RecordName:/' | sed -n 2p | cut -c 2-` 25 | fi 26 | 27 | #Prompts user to enter their login password 28 | loginPassword=`/usr/bin/osascript <