├── AppleSetupDone.sh
├── AutoIdentityPreferences.bash
├── CleanUpSmartBoard.sh
├── Clear Waiting Room.sh
├── Crashplan Clean up - Stop start cleanup.sh
├── DEP Rename-Post.sh
├── De-St. Andrews-ize.sh
├── Detect Network.sh
├── Disable Flash Notifications - Updating.sh
├── Disable Printer Sharing.sh
├── Download newest CrashPlan.sh
├── Dropbox Script.sh
├── Dyknow Log Sender.sh
├── FV - FileVaultFix.sh
├── Faculty Staff Set Department.sh
├── Fix Audacity LAME Libraries.sh
├── Fix Chrome.sh
├── ForcedReboots.bash
├── Garage Band Extras.sh
├── Google Drive script.sh.sh
├── Google Voice & Video.sh
├── HSInstall.sh
├── HelloDash.sh
├── HideQAccount.sh
├── Install FileMaker.sh
├── Install Firmware Password Utility.sh
├── Install Microsoft RD from MAS.sh
├── Install iMovie from MAS.sh
├── Notebook Install Command.sh
├── Office 2016 Open Save Defaults.sh
├── OpenDNS Certificates.sh
├── OpenDNS Removal.sh
├── Over Spring Break Sierra Notification.sh
├── Quit Relaunch Chrome.sh
├── Quit Web Browsers.sh
├── README.md
├── Re-Run Office 2011 Setup.sh
├── Remove Office 2011.sh
├── Remove OpenDNS.sh
├── Remove Pages-Numbers-Keynote-GarageBand.sh
├── Remove SAES Network from Students.sh
├── Remove SAES Temp Closed Network.sh
├── Remove Silverlight.sh
├── Remove Smart Junk.sh
├── Remove iOS Printers.sh
├── RemoveGuest - LaunchDeamon.sh
├── RemoveGuest.sh
├── Reset PRAM.sh
├── Reset Print System.sh
├── Set Faculty and Staff Admin.sh
├── Set Location Services and Time Zone etc.sh
├── Set Office Name Info.sh
├── Set Office User Script.sh
├── Set Startup Disk.sh
├── Setup CrashPlan.sh
├── Sierra Conditions and Install.sh
├── Sierra Notification.sh
├── Sierra Previously Cached.sh
├── Skype Install Script.sh
├── SoftwareUpdateFrequency.sh.sh
├── StudentIcon.sh
├── Testing - UnLock.sh
├── Testing Lockdown.sh
├── Trust Microsoft AU Daemon.sh
├── Uninstall CrashPlan.sh
├── Update everything.sh
├── VLC Install Script.sh
├── backup-scan.sh
├── boardtoolsremoval.sh
├── byebyeDash.sh
├── crashplanOpenClose.sh
├── directory_service_available.scrpt
├── faculty.sh.sh
├── keychain-piv.sh
├── office365-install.sh
├── openCP.sh.sh
├── os-upgrade-notification-disable.sh
├── power-user.sh
├── re-enroll.bash
├── setname-joinad.sh
├── setname.sh
├── silverlight fix.sh
├── staff mark.sh
└── student mark.sh
/AppleSetupDone.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | if [ -f "/var/db/.AppleSetupDone"]; then
4 | exit 0
5 | else
6 | touch /var/db/.AppleSetupDone
7 | fi
8 |
--------------------------------------------------------------------------------
/AutoIdentityPreferences.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #Watch the ~/Library/Preferences/com.apple.security.ctkd-db.plist for changes
4 | #If a card is inserted, run the script.
5 | #Auto creates identity preferences for specificed services on card insertion
6 |
7 | loggedInUser="$(/usr/sbin/scutil <<< "show State:/Users/ConsoleUser" | awk -F': ' '/[[:space:]]+Name[[:space:]]:/ { if ( $2 != "loginwindow" ) { print $2 }} ' )"
8 | System_UUID=$(system_profiler SPHardwareDataType 2>&1 | grep "Hardware UUID" | cut -d: -f2|sed -e 's/^ *//g')
9 |
10 | ########################
11 | ###CREATE LAUNCHAGENT###
12 | ########################
13 | USERS=$(dscl . list /users shell 2>&1 | grep -v /usr/bin/false | grep -v "_mbsetupuser" |grep -v "^root" | grep -v 'Guest' | awk '{print $1}')
14 |
15 |
16 | for USER in $USERS; do
17 | if [ ! -d /Users/$USER/Library/LaunchAgents ]; then
18 | mkdir /Users/$USER/Library/LaunchAgents
19 | chmod 755 /Users/$USER/Library/LaunchAgents
20 | chown $USER /Users/$USER/Library/LaunchAgents
21 | fi
22 |
23 |
24 | cat << EOF > /Users/$USER/Library/LaunchAgents/com.YourOrg.prefident.plist
25 |
26 |
27 |
28 |
29 | Label
30 | com.YourOrg.prefident
31 | ProgramArguments
32 |
33 | bash
34 | /var/tools/identpref.bash
35 |
36 | WatchPaths
37 |
38 | /Users/$USER/Library/Preferences/com.apple.security.ctkd-db.plist
39 |
40 |
41 |
42 |
43 | EOF
44 |
45 |
46 | chown $USER /Users/$USER/Library/LaunchAgents/com.YourOrg.prefident.plist
47 | chmod 644 /Users/$USER/Library/LaunchAgents/com.YourOrg.prefident.plist
48 | done
49 | ##################
50 | ##CREATE SCRIPT###
51 | ##################
52 | cat << EOF > var/tools/identpref.bash
53 | #!/bin/bash
54 | cardPresent=\$(sc_auth identities)
55 | if [ "\$cardPresent" != "" ]; then
56 | loggedInUser="\$(/usr/sbin/scutil <<< "show State:/Users/ConsoleUser" | awk -F': ' '/[[:space:]]+Name[[:space:]]:/ { if ( \$2 != "loginwindow" ) { print \$2 }} ' )"
57 |
58 | sha1=\$(/usr/bin/security export-smartcard -t certs | grep "Certificate For PIV Authentication" -A 5 | grep sha1 | head -n1 | cut -d'<' -f2 | sed "s/[ >]//g")
59 |
60 | /usr/bin/security set-identity-preference -c "\$loggedInUser" -s 'identprefadded whatever.com' -Z "\$sha1"
61 | fi
62 | EOF
63 |
64 | chown root:wheel var/tools/identpref.bash
65 | chmod 755 var/tools/identpref.bash
66 |
67 | sudo -u $loggedInUser launchctl load -w /Users/$loggedInUser/Library/LaunchAgents/com.YourOrg.prefident.plist
68 |
--------------------------------------------------------------------------------
/CleanUpSmartBoard.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # CleanUp.sh
4 | # SMART TS Tools
5 |
6 | killall -9 "Marker"
7 | killall -9 "Aware"
8 | killall -9 "SMART Ink"
9 | killall -9 "FloatingTools"
10 | killall -9 "SMARTBoardService"
11 | killall -9 "SMART Board Tools"
12 | killall -9 "Board Tools"
13 | killall -9 "Response Desktop Menu"
14 | killall -9 "Desktop Menu"
15 | killall -9 "Teacher Tools"
16 | killall -9 "ResponseSoftwareService"
17 | killall -9 "ResponseHardwareService"
18 | killall -9 "Notebook"
19 | killall -9 "Recorder"
20 | killall -9 "Welcome"
21 | killall -9 "SMART Board Control Panel"
22 | killall -9 "SMART Settings"
23 | killall -9 "SMART Product Update"
24 | killall -9 "Install Manager"
25 | killall -9 "Screen Capture"
26 | killall -9 "SMARTFirmwareUpdater"
27 | killall -9 "VantageService"
28 |
29 | #Remove Preferences
30 | rm -rf /Library/Preferences/com.smart*
31 | rm -rf /Library/Preferences/.com.smart*
32 | rm -rf /Library/Preferences/FLEXnet\ Publisher
33 | rm -rf /Users/Shared/Library/Preferences/com.smart*
34 | rm -rf /Users/Shared/Library/Preferences/.com.smart*
35 | rm -rf ~/Library/Preferences/com.smart*
36 | rm -rf ~/Library/Preferences/SmartSync
37 |
38 | #Remove Receipts
39 | rm -rf /Library/Receipts/Gallery\ Setup.pkg
40 | rm -rf /Library/Receipts/SMART*
41 | rm -rf /Library/Receipts/Notebook*
42 | rm -rf /Library/Receipts/Adobe*
43 | rm -rf /Library/Receipts/Senteo*
44 |
45 | #Remove Main Applications
46 | rm -rf /Applications/SMART*
47 | rm -rf /Applications/Notebook*
48 | rm -rf /Applications/Response*
49 | rm -rf /Applications/Senteo*
50 | rm -rf /Applications/Gallery*
51 |
52 | #Remove Remaining files
53 | rm -rf /Library/Application\ Support/SMART*
54 | rm -rf /Library/Application\ Support/FLEXnet\ Publisher
55 | rm -rf /Library/Frameworks/com.smart*
56 | rm -rf /Library/Frameworks/Senteo*
57 | rm -rf /Library/Frameworks/WebInterface*
58 | rm -rf ~/Library/Application\ Support/SMART*
59 | rm -rf ~/Library/Application\ Support/MathType\ \\ Toolbar.eql
60 | rm -rf /System/Library/Extensions/SMART*
61 | rm -rf /System/Library/Extensions/Senteo.kext
62 | rm -rf ~/Documents/SMART*
63 | rm -rf ~/Documents/LabVIEW*
64 | rm -rf ~/Documents/My\ Notebook\ Content
65 |
66 | #Remove Temp files and folders
67 | rm -rf ~/Library/Caches/Teacher\ Tools
68 | rm -rf ~/Library/Caches/TemporaryItems/SMART*
69 | rm -rf ~/Library/Caches/com.smarttech*
70 | rm -rf ~/Library/Caches/TemporaryItems/NBK*
71 | rm -rf ~/Library/Caches/Notebook*
72 | rm -rf /Library/Caches/Gallery\ Setup
73 | rm -rf ~/Library/Caches/Gallery\ Setup
74 | rm -rf ~/Library/Caches/Gallery*
75 | rm -rf ~/.NBadminMode
76 | rm -rf ~/MySMARTContent
77 |
78 | #Remove Additional
79 | rm -rf /private/tmp/SMARTBoardTools*
80 | rm -rf /Library/Caches/com.smartech.*
81 | rm -rf /var/root/Library/Preferences/com.smarttech.*
82 | rm -rf /private/var/root/Library/Preferences/com.smarttech.*
83 | rm -rf /Users/Shared/Library/Preferences/com.smarttech.*
84 | rm -rf /Library/StartupItems/Senteo*
85 | rm -rf /Library/Receipts/Senteo*
86 | rm -rf /Library/StartupItems/ResponseHardwareService
87 | rm -rf /Library/StartupItems/Senteo*
88 | rm -rf /Senteo*
89 | rm -rf /System/Library/PreferencePanes/Ink.prefPane
90 | rm -rf /Library/PreferencePanes/SMART\ Board.prefPane
91 | rm -rf /etc/launchd.conf
92 | rm -rf ~/Library/Application\ Support/SMART*
93 | rm -rf /~/.config/SMART*
94 | rm -rf /Library/StartupItems/SMART*
95 | rm -rf /SMART*
96 | rm -rf /Library/Frameworks/SMART*
97 | rm -rf /Library/Logs/SMART*
98 | rm -rf /System/Library/Extensions/Response.kext
99 |
100 |
101 | #OSX 10.6 new Receipt removal
102 | pkgutil --pkgs="com.smarttech.*" | while read line; do pkgutil --forget "$line"; done
103 |
104 |
--------------------------------------------------------------------------------
/Clear Waiting Room.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | rm -rf /Library/Application\ Support/JAMF/Waiting\ Room/*
4 |
--------------------------------------------------------------------------------
/Crashplan Clean up - Stop start cleanup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | launchctl unload /Library/LaunchDaemons/com.crashplan.engine.plist
4 | rm -rf /Library/Caches/CrashPlan/*
5 | launchctl load /Library/LaunchDaemons/com.crashplan.engine.plist
6 |
--------------------------------------------------------------------------------
/DEP Rename-Post.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #On Enrollment run the script from
4 | #https://www.macblog.org/post/automatically-renaming-computers-from-a-google-sheet-with-jamf-pro/
5 | #Computer is renamed, now at first login it'll personalize that
6 |
7 | #Runs at login to set computer name, re-joins AD, and sets user and department
8 |
9 | InventoryTag=$(hostname)
10 | LoggedInUser=$(ls -l /dev/console | awk '{ print $3 }')
11 |
12 | echo "Hello $LoggedInUser on $InventoryTag"
13 |
14 | #Checks if a faculty or staff...if not it's a student.
15 | if dscl '/Active Directory/ACADEMIC/All Domains' -read /Users/"$LoggedInUser" | grep "Faculty and Staff"; then
16 | ComputerName=$InventoryTag$(echo $LoggedInUser | cut -c 2-)
17 | echo "Employee"
18 | #pops up pashua to set user and department
19 | jamf policy -event setdeptDEP
20 |
21 | touch /var/.faculty
22 |
23 | if [ -e "/var/.student" ]; then
24 | rm /var/.student
25 | echo "no longer student"
26 | fi
27 | else
28 | echo "Student"
29 | ComputerName="S"$InventoryTag
30 | #gets user info from AD to populate
31 | getclass=`dscl '/Active Directory/ACADEMIC/All Domains' -read /Users/$LoggedInUser dsAttrTypeNative:distinguishedName | awk '{ FS=","; print $2 }' | awk '{ FS="="; print $2 }' | tail -1`
32 | getRealName=$(id -F "$LoggedInUser")
33 | #getRealName=`dscl '/Active Directory/ACADEMIC/All Domains' -read /Users/$LoggedInUser RealName | grep -v ":"`
34 |
35 | if [ -e "/var/.staff" ]; then
36 | rm /var/.staff
37 | echo "no longer staff"
38 | fi
39 | if [ -e "/var/.faculty" ]; then
40 | rm /var/.faculty
41 | echo "no longer faculty"
42 | fi
43 |
44 | touch /var/.student
45 | echo "My Class is - $getclass"
46 | echo "My Full Name is - $getRealName"
47 | jamf recon -endUsername $LoggedInUser -department "$getclass" -building "Postoak" -realname "$getRealName" -email "$LoggedInUser@saes.org" &
48 | fi
49 |
50 | echo "My Computer's new name is $ComputerName"
51 | echo $ComputerName > /var/.computername
52 |
53 | #removes from AD, renames computer, and rejoins AD
54 | #does an authenticated AD remove which removes it from AD server itself
55 | dsconfigad -remove -u ENTER-AD-USER -p ENTER-AD-PASSWORD
56 | scutil --set ComputerName "$ComputerName"
57 | scutil --set LocalHostName "$ComputerName"
58 | scutil --set HostName "$ComputerName"
59 | jamf setComputerName -name "$ComputerName"
60 | dscacheutil -flushcache
61 |
62 | #Rejoin AD
63 | jamf policy -event joinad
64 |
65 | rm -f /var/tmp/computernames.csv
66 |
67 | exit 0
68 |
--------------------------------------------------------------------------------
/De-St. Andrews-ize.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | nvram -d boot-args
4 | nvram -c
5 | /usr/local/bin/jamf setOFP -mode none
6 |
7 | jamf policy -event fwpsswd
8 |
9 | #User stuff like upgrading permissions and remove from AD
10 | getUser=`ls -l /dev/console | awk '{ print $3 }'`
11 | dseditgroup -o edit -a $getUser -T group admin
12 | dsconfigad -force -remove -u johnnynobody -p nopassword
13 |
14 | #get rid of apps
15 | jamf policy -event uninstallCP
16 |
17 | /Library/Application\ Support/CrashPlan/Unistall.app/Contents/Resources/unistall.sh
18 | sleep 2
19 | rm -rf /Library/Application\ Support/CrashPlan
20 | rm -rf /Applications/CrashPlan.app
21 |
22 |
23 | #byebyeOpenDNS
24 |
25 | launchctl remove com.opendns.osx.RoamingClientMenubar
26 | launchctl remove com.opendns.osx.RoamingClientConfigUpdater
27 | launchctl remove com.opendns.osx.RoamingClientConfigUpdater
28 |
29 | sleep 5
30 |
31 | for i in '/Library/LaunchDaemons/com.opendns.osx.RoamingClientConfigUpdater.plist' '/Library/LaunchAgents/com.opendns.osx.RoamingClientMenubar.plist' '/Applications/OpenDNS Roaming Client' '/ Library/Application Support/OpenDNS Roaming Client' '/usr/local/sbin/dnscrypt-proxy' '/usr/local/share/man/man8/dnscrypt-proxy.8' '/var/lib/data/opendns' '/usr/local/lib/dnscrypt-proxy'
32 | do rm -fr \"$i\"
33 |
34 | done;
35 |
36 | killall RoamingClientMenubar
37 | killall dnscrypt-proxy
38 |
39 | rm -rf /Library/LaunchAgents/com.opendns.osx.RoamingClientMenubar.plist
40 | rm -rf /Library/LaunchDaemons/com.opendns.osx.RoamingClientConfigUpdater.plist
41 | rm -rf /Library/Application\ Support/OpenDNS\ Roaming\ Client
42 | rm -rf /usr/local/lib/dnscrypt-proxy
43 | rm -rf /Applications/OpenDNS\ Roaming\ Client/
44 |
45 | pkgutil --forget com.opendns.osx.RoamingClient
46 |
47 |
48 |
49 | #peace out dyknow
50 |
51 | launchctl unload /Library/LaunchAgents/com.dyknow.monitor.plist
52 | launchctl remove com.dyknow.monitor.plist
53 | launchctl unload /Library/LaunchDaemons/com.dyknow.update.plist
54 | launchctl remove com.dyknow.update.plist
55 |
56 | ps ax | grep "/Applications/.cloud/DyKnow.app/Contents/MacOS/DyKnow" | awk '{print $1}' | xargs kill -9 2> /dev/null
57 | killall DyKnow
58 |
59 | rm -rf /Library/.dyknow
60 | rm -rf "/Library/Application Support/.dyknow"
61 | rm -rf "/Library/Application Support/DyKnow"
62 | rm -rf /Library/LaunchAgents/com.dyknow.monitor.plist
63 | rm -rf /Library/LaunchDaemons/com.dyknow.update.plist
64 |
65 | rm -rf /Applications/DyKnow.app
66 | rm -rf /Applications/DyKnowLogSender.app
67 |
68 | rm -rf /Applications/.cloud
69 |
70 |
71 |
72 |
73 | rm -rf /Applications/CrashPlan.app
74 | rm -rf /Applications/Inspiration\ 9
75 | rm -rf /Applications/Kidspiration\ 3
76 | rm -rf /Applications/SAM\ Animation.app
77 | rm -rf /Applications/Securexam
78 | rm -rf /Applications/ERB\ Secure\ Browser.app
79 | rm -rf /Applications/Adobe*
80 | rm -rf /Applications/Zotero.app
81 |
82 | jamf policy -event removeOffice2011
83 |
84 | ps ax | grep "/Applications/Microsoft Word.app" | awk '{print $1}' | xargs kill -9 2> /dev/null
85 | ps ax | grep "/Applications/Microsoft Excel.app" | awk '{print $1}' | xargs kill -9 2> /dev/null
86 | ps ax | grep "/Applications/Microsoft PowerPoint.app" | awk '{print $1}' | xargs kill -9 2> /dev/null
87 | ps ax | grep "/Applications/Microsoft Outlook.app" | awk '{print $1}' | xargs kill -9 2> /dev/null
88 |
89 | rm -rf /Library/Preferences/com.microsoft.office.licensingV2.plist
90 | rm -rf $HOME/Library/Group\ Containers/UBF8T346G9.Office/com.microsoft.Office365.plist
91 | rm -rf $HOME/Library/Group\ Containers/UBF8T346G9.Office/com.microsoft.e0E2OUQxNUY1LTAxOUQtNDQwNS04QkJELTAxQTI5M0JBOTk4O.plist
92 | rm -rf $HOME/Library/Group\ Containers/UBF8T346G9.Office/e0E2OUQxNUY1LTAxOUQtNDQwNS04QkJELTAxQTI5M0JBOTk4O
93 |
94 |
95 | /usr/bin/security delete-internet-password -s 'msoCredentialSchemeADAL' 2> /dev/null 1> /dev/null
96 | /usr/bin/security delete-internet-password -s 'msoCredentialSchemeLiveId' 2> /dev/null 1> /dev/null
97 |
98 |
99 | sleep 5
100 |
101 | #bye Q, nice knowing you
102 | #dscl . -delete /Users/q
103 | #rm -rf /Users/q
104 | sysadminctl -deleteUser q
105 |
106 | sleep 3
107 |
108 | killall "Self Service"
109 |
110 | #the final step. Remove jamf
111 | /usr/local/bin/jamf removeFramework
112 |
--------------------------------------------------------------------------------
/Detect Network.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | networksetup -detectnewhardware
4 |
--------------------------------------------------------------------------------
/Disable Flash Notifications - Updating.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | if [ ! -d /Library/Application\ Support/Macromedia ]; then
4 | mkdir /Library/Application\ Support/Macromedia
5 | chown root:admin /Library/Application\ Support/Macromedia
6 | chmod 755 /Library/Application\ Support/Macromedia
7 | fi
8 |
9 | cat < /Library/Application\ Support/Macromedia/mms.cfg
10 | AutoUpdateDisable=1
11 | SilentAutoUpdateEnable=0
12 | EOT
13 |
14 |
--------------------------------------------------------------------------------
/Disable Printer Sharing.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # This script disables printer sharing on a designated printer.
4 |
5 | printer_name="$4"
6 |
7 | lpadmin -p "$printer_name" -o printer-is-shared=false
8 |
9 | echo "Print Sharing for $printer_name has been disabled."
10 |
11 | exit 0
--------------------------------------------------------------------------------
/Download newest CrashPlan.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | curl http://saes-cp-a.saes.org:4280/download/CrashPlanPROe_Mac.dmg > /var/tmp/CP.dmg
4 | hdiutil attach /var/tmp/CP.dmg
5 | installer -pkg /Volumes/CrashPlanPROe/Install\ CrashPlanPROe.pkg -target /
6 | hdiutil detach /Volumes/CrashPlanPROe/
7 | rm -rf /var/tmp/CP.dmg
8 |
--------------------------------------------------------------------------------
/Dropbox Script.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir /tmp/getmacapps_temp
4 | cd /tmp/getmacapps_temp
5 |
6 | # Installing Dropbox
7 | curl -L -o Dropbox.dmg "https://www.dropbox.com/download?plat=mac"
8 | hdiutil mount -nobrowse Dropbox.dmg
9 | rsync -vaz "/Volumes/Dropbox Installer/Dropbox.app/" /Applications/Dropbox.app
10 | hdiutil unmount "/Volumes/Dropbox Installer"
11 | rm Dropbox.dmg
12 |
--------------------------------------------------------------------------------
/Dyknow Log Sender.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 |
4 | sudo -u $3 /Applications/DyKnowLogSender.app/Contents/MacOS/DyKnowLogSender -vanity "$4" -notes "$3"
--------------------------------------------------------------------------------
/FV - FileVaultFix.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | ###################################################################
4 | #: Date Created : (October 25th, 2018)
5 | #: Author : Bob Gendler
6 | #
7 | #Add the user and the password as paramters in the script in jamf
8 | #This must be an already FileVault enabled account
9 | #
10 | ###################################################################
11 |
12 | adminuser="${4}"
13 | adminpass="${5}"
14 |
15 | loggedInUser=`python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");'`
16 | userpassword=$(osascript -e 'display dialog "Please enter a your login password." default answer "" with icon stop buttons {"Cancel", "Continue"} default button "Continue" with hidden answer' | awk -F ':' '{print $3}')
17 |
18 | if ! fdesetup list | grep "${adminuser}"; then
19 | /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "User not found" -description "The ${adminuser} account is not FileVault enabled. That account must be enabled before continuing." -button1 "Ok" -defaultButton 1 -icon /System/Library/CoreServices/Problem\ Reporter.app/Contents/Resources/ProblemReporter.icns
20 | exit 0
21 | fi
22 |
23 | fdesetup remove -user "${loggedInUser}"
24 |
25 | if [ "$?" != "0" ]; then
26 | /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "An Error Occured" -description "An error occured with your account and FileVault. Please contact your Tech Support." -button1 "Ok" -defaultButton 1 -icon /System/Library/CoreServices/Problem\ Reporter.app/Contents/Resources/ProblemReporter.icns
27 | echo "User not removed successfully from FileVault"
28 | exit 1
29 | else
30 | echo "User successfully removed from FileVault"
31 | fi
32 |
33 | echo "${loggedInUser}" "${adminuser}" "${adminpass}" "${userpassword}"
34 | echo "log_user 1" > /var/tmp/expectfile
35 | echo 'spawn fdesetup add -usertoadd [lindex $argv 0] -user [lindex $argv 1]' >> /var/tmp/expectfile
36 | echo 'expect ":"' >> /var/tmp/expectfile
37 | echo 'send "[lindex $argv 2]\\r"' >> /var/tmp/expectfile
38 | echo 'expect ":"' >> /var/tmp/expectfile
39 | echo 'send "[lindex $argv 3]\\r"' >> /var/tmp/expectfile
40 | echo 'interact' >> /var/tmp/expectfile
41 |
42 | expect -f /var/tmp/expectfileexpectfile "${loggedInUser}" "${adminuser}" "${adminpass}" "${userpassword}"
43 |
44 | rm /var/tmp/expectfileexpectfile
45 |
46 | if fdesetup list | grep "${loggedInUser}"; then
47 | /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "FileVault User Added" -description "${loggedInUser} was successfully re-added to Filevault with the new password." -button1 "Ok" -defaultButton 1 -icon /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/FileVaultIcon.icns
48 | else
49 | /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "An Error Occured" -description "An error occured with your account and FileVault. Please contact your Tech Support." -button1 "Ok" -defaultButton 1 -icon /System/Library/CoreServices/Problem\ Reporter.app/Contents/Resources/ProblemReporter.icns
50 | fi
51 |
52 |
--------------------------------------------------------------------------------
/Faculty Staff Set Department.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | pashuapath="/usr/local/saes/Pashua.app/Contents/MacOS/Pashua"
4 |
5 | pashua_run() {
6 |
7 | # Write config file
8 | local pashua_configfile=`/usr/bin/mktemp /tmp/pashua_XXXXXXXXX`
9 | echo "$1" > "$pashua_configfile"
10 |
11 | if [ "" = "$pashuapath" ]
12 | then
13 | >&2 echo "Error: Pashua could not be found"
14 | exit 1
15 | fi
16 |
17 | # Get result
18 | local result=$("$pashuapath" "$pashua_configfile")
19 |
20 | # Remove config file
21 | rm "$pashua_configfile"
22 |
23 | oldIFS="$IFS"
24 | IFS=$'\n'
25 |
26 | # Parse result
27 | for line in $result
28 | do
29 | local name=$(echo $line | sed 's/^\([^=]*\)=.*$/\1/')
30 | local value=$(echo $line | sed 's/^[^=]*=\(.*\)$/\1/')
31 | eval $name='$value'
32 | done
33 |
34 | IFS="$oldIFS"
35 | }
36 |
37 | #API login info
38 | apiuser="JSS API USER"
39 | apipass="JSS API USER PASSWORD"
40 | jamfProURL="YOUR JAMF PRO SERVER"
41 |
42 | #update via serial number
43 | apiURL="JSSResource/computers/serialnumber"
44 | MacSerial=$(ioreg -rd1 -c IOPlatformExpertDevice | awk -F'"' '/IOPlatformSerialNumber/{print $4}')
45 |
46 | #XML header stuff
47 | xmlHeader=""
48 |
49 | #Current User stuff
50 | getUser=$(ls -l /dev/console | awk '{ print $3 }')
51 | #getUser=$3
52 | getRealName=$(id -F "$getUser")
53 |
54 | #API data load
55 | xmlresult=$(curl -k "$jamfProURL/JSSResource/departments" --user "$apiuser:$apipass" -H "Accept: application/xml" --silent | xmllint --format - | awk -F'>|<' '//{print $3","}')
56 |
57 | #Cut last character
58 | xmlresult=${xmlresult%?}
59 |
60 | #Replace and cut the lines we don't need
61 | tweaked=$(sed 's/,/ \\\npop.option =/g' <<< $xmlresult)
62 | tweaked=$(echo $tweaked | grep -v "AppleTVs" | grep -v "iPads" | grep -v "Class" | grep -v "Cart" | grep -v "Video" | grep -v "Library" | grep -v "Macs")
63 | #echo $tweaked
64 |
65 | conf="#Set window title
66 | *.title = Select Department
67 | *.floating = 1
68 | # Add a popup menu
69 |
70 | pop.type = popup
71 | pop.label = Please select your department
72 | pop.width = 300
73 | pop.option = $tweaked"
74 | pashua_run "$conf"
75 |
76 | jamf recon -endUsername $getUser -department "$pop" -building "Postoak" -realname "$getRealName" -email "$getUser@emailaddress"
77 |
--------------------------------------------------------------------------------
/Fix Audacity LAME Libraries.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | chmod -R 755 /usr/local/lib/
--------------------------------------------------------------------------------
/Fix Chrome.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | getUser=`ls -l /dev/console | awk '{ print $3 }'`
4 | UserHome="/Users/$getUser"
5 |
6 | ps ax | grep "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" | awk '{print $1}' | xargs kill -9 2> /dev/null
7 | mv "$UserHome/Library/Application Support/Google/Chrome/Default/Bookmarks" $UserHome/Bookmarks
8 | rm -rf "$UserHome/Library/Application Support/Google/Chrome"
9 | mkdir -p "$UserHome/Library/Application Support/Google/Chrome/Default"
10 | mv $UserHome/Bookmarks "$UserHome/Library/Application Support/Google/Chrome/Default/Bookmarks"
11 | chmod -R 700 "$UserHome/Library/Application Support/Google/Chrome/"
12 | chown -R $getUser "$UserHome/Library/Application Support/Google/Chrome/"
--------------------------------------------------------------------------------
/ForcedReboots.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #Variables that need set
4 | #$4 set as "appleupdates" if you want apple softwareupdate ran.
5 | #$5 is days to defer
6 | prefLocation="/var/info/Reboot.plist"
7 | boundName=$(dsconfigad -show | awk '/Computer Account/{print $NF}' | sed 's/$$//')
8 | daysToDefer="$5"
9 |
10 |
11 |
12 | ##########REBOOT LATER FUNCTION#################
13 | function rebootLater {
14 |
15 | installedDate=$(/usr/libexec/PlistBuddy -c "print :installedDate" "${prefLocation}")
16 | todayDate=$(date "+%m-%d-%Y")
17 | declare -i dateDiff
18 | dateDiff=$(date -j -f "%m-%d-%Y" "$todayDate" "+%s")-$(date -j -f "%m-%d-%Y" "$installedDate" "+%s")
19 | dateDiff=dateDiff/86400
20 |
21 | DaysFromNow=$(/usr/libexec/PlistBuddy -c "print :DaysFromNow" "${prefLocation}")
22 | declare -i DaysLeftToDefer
23 | DaysLeftToDefer=$(/usr/libexec/PlistBuddy -c "print :DaysLeftToDefer" "${prefLocation}")
24 |
25 | description="An update to your computer was installed on ${installedDate}, ${dateDiff} days ago.
26 |
27 | Your computer requires a restart. It will be restarted in ${DaysLeftToDefer} days"
28 |
29 | title="Restart required"
30 |
31 | heading="Your computer will restart on ${DaysFromNow}"
32 |
33 | installationdelay=$(/Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "${title}" -heading "${heading}" -description "${description}" -icon "/System/Library/CoreServices/Install Command Line Developer Tools.app/Contents/Resources/SoftwareUpdate.icns" -button1 "Ok" -button2 "Later" -defaultButton 1 -showDelayOptions "0, 60, 300, 900" )
34 |
35 | if [ "${installationdelay}" = "2" ]; then
36 | #Subtract a day left from the preference file.
37 | DaysLeftToDefer=$((DaysLeftToDefer-1))
38 | /usr/libexec/PlistBuddy -c "set :DaysLeftToDefer ${DaysLeftToDefer}" "${prefLocation}"
39 |
40 | else
41 | #if NOW is selected or dialog box timed out
42 | if [[ $installationdelay -eq 1 ]];then
43 | jamf reboot -startTimerImmediately -background
44 | else
45 | #Do this in X minutes. Dialog gives you seconds, gotta convert to minutes and strip off the exit code.
46 | declare -i delayInMin
47 | size=${#installationdelay}
48 | delayInMin=${installationdelay:0:size-1}/60
49 | rm -f ${prefLocation}
50 | jamf reboot -minutes "${delayInMin}" -startTimerImmediately -background
51 | fi
52 | fi
53 | }
54 |
55 | ##########REBOOT NOW FUNCTION#################
56 | function rebootNow {
57 |
58 | installedDate=$(/usr/libexec/PlistBuddy -c "print :installedDate" "${prefLocation}")
59 | todayDate=$(date "+%m-%d-%Y")
60 | declare -i dateDiff
61 | dateDiff=$(date -j -f "%m-%d-%Y" "$todayDate" "+%s")-$(date -j -f "%m-%d-%Y" "$installedDate" "+%s")
62 | dateDiff=dateDiff/86400
63 |
64 | description="An update to your computer was installed on ${installedDate}, ${dateDiff} days ago.
65 |
66 | Your computer requires a restart. Please save all work as your computer will be restarted shortly"
67 |
68 | title="Restart required"
69 |
70 | heading="Your computer will restart shortly"
71 |
72 | installationdelay=$(/Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "${title}" -heading "${heading}" -description "${description}" -icon "/System/Library/CoreServices/Install Command Line Developer Tools.app/Contents/Resources/SoftwareUpdate.icns" -button1 "Ok" -defaultButton 1 -showDelayOptions "0, 60, 300, 900" -timeout 30 -countdown)
73 | #if NOW is selected or dialog box timed out
74 | if [[ $installationdelay -eq 1 ]]; then
75 | rm -f ${prefLocation}
76 | jamf reboot -background
77 | else
78 | #Do this in X minutes. Dialog gives you seconds, gotta convert to minutes and strip off the exit code.
79 | declare -i delayInMin
80 | size=${#installationdelay}
81 | delayInMin=${installationdelay:0:size-1}/60
82 | rm -f ${prefLocation}
83 | jamf reboot -minutes "${delayInMin}" -startTimerImmediately -background
84 | fi
85 | }
86 |
87 | #####The Main Portion#####
88 |
89 | #if the plist doesnt exist, create it
90 | if [ ! -f "${prefLocation}" ]; then
91 |
92 | #Check Apple Software Updates
93 | if [[ "$4" = "appleupdates" ]]; then
94 | rebootRequired=$(softwareupdate -l | grep -o restart 2>&1)
95 | if [[ "$rebootRequired" =~ "restart" ]]; then
96 | echo "Apple Software Update requires a reboot"
97 | softwareupdate -i -a
98 | else
99 | echo "Apple Software Update does not require a reboot"
100 | softwareupdate -i -a
101 | exit 0
102 | fi
103 | fi
104 |
105 | DaysFromNow=$(date -v +${daysToDefer}d "+%m-%d-%Y")
106 | installedDate=$(date "+%m-%d-%Y")
107 | /usr/libexec/PlistBuddy -c "add :installedDate string ${installedDate}" "${prefLocation}" &> /dev/null
108 | /usr/libexec/PlistBuddy -c "add :DaysFromNow string ${DaysFromNow}" "${prefLocation}"
109 | /usr/libexec/PlistBuddy -c "add :DaysLeftToDefer string ${daysToDefer}" "${prefLocation}"
110 | jamf recon&
111 |
112 | #if it does exist, then we must have an update installed
113 | else
114 |
115 | loggedInUser=$(python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");')
116 | if [ -z "$loggedInUser" ]; then
117 | echo "Nobody logged in, here we go"
118 | jamf reboot -background
119 |
120 | else
121 |
122 | declare -i dateDiff
123 | installedDate=$(/usr/libexec/PlistBuddy -c "print :installedDate" "${prefLocation}")
124 | todayDate=$(date "+%m-%d-%Y")
125 | DaysFromNow=$(/usr/libexec/PlistBuddy -c "print :DaysFromNow" "${prefLocation}")
126 | dateDiff=$(date -j -f "%m-%d-%Y" "$todayDate" "+%s")-$(date -j -f "%m-%d-%Y" "$installedDate" "+%s")
127 | dateDiff=dateDiff/86400
128 | DaysLeftToDefer=$(/usr/libexec/PlistBuddy -c "print :DaysLeftToDefer" "${prefLocation}")
129 |
130 | if [[ $dateDiff -ge $daysToDefer ]] || [[ $DaysLeftToDefer -eq 0 ]]; then
131 | rebootNow
132 | else
133 | rebootLater
134 | fi
135 | fi
136 | fi
137 |
--------------------------------------------------------------------------------
/Garage Band Extras.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | curl http://downloads.apple.com/static/gb/gb11bc/GarageBandBasicContent.pkg > /GarageBandBasicContent.pkg
4 | curl http://audiocontentdownload.apple.com/lp9_ms2_content_2011/MGBContentCompatibility.pkg > /MGBContentCompatibility.pkg
5 |
6 | installer -pkg /GarageBandBasicContent.pkg -target /
7 | installer -pkg /MGBContentCompatibility.pkg -target /
8 |
9 | #rm -rf /GarageBandBasicContent.pkg
10 | #rm -rf //MGBContentCompatibility.pkg
--------------------------------------------------------------------------------
/Google Drive script.sh.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | mkdir /tmp/getmacapps_temp
4 | cd /tmp/getmacapps_temp
5 |
6 | curl -L -o googledrive.dmg https://dl.google.com/drive/installgoogledrive.dmg
7 |
8 | hdiutil mount googledrive.dmg -nobrowse -mountpoint "/Volumes/Install Google Drive"
9 | cp -Rp /Volumes/Install\ Google\ Drive/Google\ Drive.app /Applications/Google\ Drive.app
10 | hdiutil unmount "/Volumes/Install Google Drive"
11 | rm googledrive.dmg
12 | killall Finder
13 | open "/Applications/Google Drive.app" &
14 |
15 | # CurrentUser=`ls -l /dev/console | awk '{ print $3 }'`
16 | # dscl . -append /Groups/admin GroupMembership $CurrentUser
17 | # open "/Applications/Google Drive.app"/
18 | # sleep 180
19 | # dscl . -delete /Groups/admin GroupMembership $CurrentUser
20 |
--------------------------------------------------------------------------------
/Google Voice & Video.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | mkdir /tmp/downloads
4 | cd /tmp/downloads
5 |
6 |
7 |
8 | curl -O https://dl.google.com/googletalk/googletalkplugin/GoogleVoiceAndVideoSetup.dmg
9 |
10 |
11 | hdiutil attach GoogleVoiceAndVideoSetup.dmg -nobrowse -noverify -noautoopen
12 |
13 |
14 | installer -dumplog -verbose -pkg /Volumes/GoogleVoiceAndVideoAccelSetup*/Google\ Voice\ and\ Video.pkg -target "/"
15 |
16 |
17 | hdiutil eject -force /Volumes/GoogleVoiceAndVideo*
18 |
19 |
20 | rm -rf /tmp/downloads/GoogleVoiceAndVideoSetup.dmg
21 |
--------------------------------------------------------------------------------
/HSInstall.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #This does a lot of checks to make sure there's all the right conditions to begin install High Sierra
4 | #Do you have the right version of office? If not it will install the newest
5 | #Do you have enough space?
6 | #Are you already on High Sierra
7 | #Is there enough power?
8 | #Is it cached?
9 |
10 | #Function used to call starting to install....plist supposedly makes an authenticated restart buuuut
11 | StartInstall ()
12 | {
13 | OfficeMajorVer=$(defaults read /Applications/Microsoft\ Word.app/Contents/Info.plist CFBundleShortVersionString | cut -c 1-2)
14 | OfficeMinorVer=$(defaults read /Applications/Microsoft\ Word.app/Contents/Info.plist CFBundleShortVersionString | cut -c 4-5)
15 | fileVaultStatus=$(fdesetup status | awk '{print $3}' | tr -d ".")
16 |
17 | if [ "$fileVaultStatus" = "On" ]; then
18 |
19 | cat << EOF > /Library/LaunchAgents/com.apple.install.osinstallersetupd.plist
20 |
21 |
22 |
23 |
24 | Label
25 | com.apple.install.osinstallersetupd
26 | LimitLoadToSessionType
27 | Aqua
28 | MachServices
29 |
30 | com.apple.install.osinstallersetupd
31 |
32 |
33 | TimeOut
34 | Aqua
35 | OnDemand
36 |
37 | ProgramArguments
38 |
39 | /Applications/Install macOS High Sierra.app/Contents/Frameworks/OSInstallerSetup.framework/Resources/osinstallersetupd
40 |
41 |
42 |
43 | EOF
44 | getUser=$(ls -l /dev/console | awk '{ print $3 }')
45 |
46 | echo "running launchctl as $getUser"
47 | chown root:wheel /Library/LaunchAgents/com.apple.install.osinstallersetupd.plist
48 | chmod 755 /Library/LaunchAgents/com.apple.install.osinstallersetupd.plist
49 | sudo -u $getUser launchctl load -w -F /Library/LaunchAgents/com.apple.install.osinstallersetupd.plist
50 | sudo -u $getUser launchctl start -w -F com.apple.install.osinstallersetupd
51 | fi
52 |
53 | #IF Microsoft Office too old, then update it to compatibility with High Sierra
54 | if [ $OfficeMajorVer -lt 16 ]; then
55 | if [ $OfficeMinorVer -lt 35 ]; then
56 | /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "Microsoft Office needs updated" -description "The version of Microsoft Office installed on your computer is not compatible with macOS High Sierra. Microsoft Office will upgrade before continuing. This may add an additional 10 to 15 minutes to the upgrading process." -button1 "Ok" -defaultButton 1 -icon "/Applications/Install macOS High Sierra.app/Contents/Resources/ProductPageIcon.icns"
57 | ps ax | grep "/Applications/Microsoft Word.app" | awk '{print $1}' | xargs kill -9 2> /dev/null
58 | ps ax | grep "/Applications/Microsoft Excel.app" | awk '{print $1}' | xargs kill -9 2> /dev/null
59 | ps ax | grep "/Applications/Microsoft PowerPoint.app" | awk '{print $1}' | xargs kill -9 2> /dev/null
60 | ps ax | grep "/Applications/Microsoft Outlook.app" | awk '{print $1}' | xargs kill -9 2> /dev/null
61 | jamf policy -event MSOffice2016
62 | fi
63 | fi
64 |
65 |
66 | #Dialog comes up and calls the starttoinstall command in the High Sierra Installer
67 | /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "Installing macOS High Sierra" -description "mac OS High Sierra will begin installing momentarily.
68 |
69 | Please save all work NOW as all unsaved work will be LOST." -button1 "Ok" -icon "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/Sync.icns" -defaultButton 1 &
70 | /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/startosinstall --applicationpath "/Applications/Install macOS High Sierra.app" --agreetolicense
71 |
72 | killall "Self Service"
73 | exit 0
74 | }
75 |
76 |
77 | OS=$(sw_vers -productVersion | cut -c 1-5)
78 | #Checks to see if OS is on 10.13, if it is, it reports home witha recon
79 | if [ "$OS" = "10.13" ]; then
80 | /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "High Sierra Installed" -description "mac OS High Siera is already installed" -button1 "Ok" -icon "/Applications/Utilities/System Information.app/Contents/Resources/SystemLogo.tiff" -defaultButton 1 &
81 | echo "10.13 already installed"
82 | ps ax | grep "/Applications/SAES Self Service.app" | awk '{print $1}' | xargs kill -9 2> /dev/null
83 | exit 0
84 | fi
85 |
86 | #Do you have enough storage?
87 | #If not pop up message and let people know
88 | StorageAvail=$(system_profiler SPStorageDataType | grep -A2 "Macintosh HD" | grep "Available:" | awk -F " " '{print $2}' | cut -d "." -f 1)
89 |
90 | StorageAvail="${StorageAvail//[$'\t\r\n ']}"
91 |
92 | echo "Computer has $StorageAvail space available"
93 |
94 | if [ "$StorageAvail" -lt 10 ]; then
95 | jamf displayMessage -message "Your computer does not have enough space. You have only $(df -H / | tail -1 | awk '{print $4}') GB of space free. MacOS High Sierra requires at least 10 GB of free space available. If you need help making room, please visit the Technology Office."
96 | echo "Not enough storage space"
97 | exit 0
98 | fi
99 |
100 | #Is High Sierra even cached?
101 | if [ ! -d "/Applications/Install macOS High Sierra.app" ]; then
102 | echo "not cached"
103 | /usr/local/bin/jamf policy -event highsierra &
104 | /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "High Sierra Not Cached" -description "mac OS High Sirra is not cached and is not yet ready to be installed, please check back soon." -button1 "Ok" -icon "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/Bonjour.icns" -defaultButton 1 &
105 | exit 0
106 | fi
107 |
108 | #Are you plugged in and if not, is there enough power
109 | PluggedInYN=$(pmset -g ps | grep "Power" | cut -c 18- | tr -d "'")
110 |
111 | if [ "$PluggedInYN" = "AC Power" ]; then
112 | echo "plugged in"
113 | #if every condition is met call the StartInstall function and begin install
114 | StartInstall
115 |
116 | else
117 | BatteryPercentage=$(pmset -g ps | tail -1 | awk -F ";" '{print $1}' | awk -F "\t" '{print $2}' | tr -d "%")
118 | if [ $BatteryPercentage -ge 50 ]; then
119 | echo "laptop over 50% power"
120 | #if every condition is met call the StartInstall function and begin install
121 | StartInstall
122 |
123 | else
124 | jamf displayMessage -message "Please plug your laptop in while installing. You do not have enough power to install macOS Sierra. You have $BatteryPercentage% power left"
125 | echo "not enough juice"
126 | exit 0
127 | fi
128 | fi
129 |
--------------------------------------------------------------------------------
/HelloDash.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | getUser=`ls -l /dev/console | awk '{ print $3 }'`
4 | defaults write /Users/$getUser/Library/Preferences/com.apple.dashboard mcx-disabled -boolean NO
5 | sudo -u $getUser killall Dock
6 |
--------------------------------------------------------------------------------
/HideQAccount.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #delete current user's desktop items
4 | #WARNING, THIS WILL DELETE EVERYTHING
5 |
6 | sudo defaults write /Library/Preferences/com.apple.loginwindow HiddenUsersList -array-add q
7 |
--------------------------------------------------------------------------------
/Install FileMaker.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 |
4 | /usr/sbin/installer -pkg "/var/tmp/Filemaker/FileMaker Pro 15.pkg" -target /
5 |
6 | rm -rf /var/tmp/Filemaker
7 |
--------------------------------------------------------------------------------
/Install Firmware Password Utility.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 |
4 | /usr/sbin/diskutil mount Recovery\ HD
5 | /usr/bin/hdiutil attach -quiet /Volumes/Recovery\ HD/com.apple.recovery.boot/BaseSystem.dmg
6 | if [ -f /Volumes/Mac\ OS\ X\ Base\ System/Applications/Utilities/Firmware\ Password\ Utility.app/Contents/Resources/setregproptool ]; then
7 | cp /Volumes/Mac\ OS\ X\ Base\ System/Applications/Utilities/Firmware\ Password\ Utility.app/Contents/Resources/setregproptool /Library/Application\ Support/JAMF/bin/
8 | /usr/bin/hdiutil detach /Volumes/Mac\ OS\ X\ Base\ System
9 | else
10 | cp /Volumes/OS\ X\ Base\ System/Applications/Utilities/Firmware\ Password\ Utility.app/Contents/Resources/setregproptool /Library/Application\ Support/JAMF/bin/
11 | /usr/bin/hdiutil detach /Volumes/OS\ X\ Base\ System
12 | fi
13 |
14 | /usr/sbin/diskutil unmount Recovery\ HD
15 |
--------------------------------------------------------------------------------
/Install Microsoft RD from MAS.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | id='appleID login'
4 | passwd='apple ID password'
5 |
6 | #sign out
7 | /var/mas/mas signout
8 |
9 | sleep 3
10 |
11 | #sign in
12 | /var/mas/mas signin $id $passwd
13 |
14 | sleep 3
15 |
16 | #install apps
17 | /var/mas/mas install 715768417
18 |
19 | #sign out
20 |
21 | /var/mas/mas signout
22 |
23 | exit 0
--------------------------------------------------------------------------------
/Install iMovie from MAS.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 |
4 | id='appleID login'
5 | passwd='apple ID password'
6 |
7 | #sign out
8 | /var/mas/mas signout
9 |
10 | sleep 3
11 |
12 | #sign in
13 | /var/mas/mas signin $id $passwd
14 |
15 | sleep 3
16 |
17 | #install apps
18 | if [ -d "/Applications/iMovie.app" ]; then
19 | if [ $4 == "Yes" ]; then
20 | /var/mas/mas install 408981434
21 | else
22 | echo "iMovie Already Installed"
23 | fi
24 | else
25 | /var/mas/mas install 408981434
26 | fi
27 |
28 | #sign out
29 |
30 | /var/mas/mas signout
31 |
32 | exit 0
--------------------------------------------------------------------------------
/Notebook Install Command.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | installer -target / -pkg "/var/tmp/Notebook 14.3 Install/Notebook 14.3.pkg"
4 |
--------------------------------------------------------------------------------
/Office 2016 Open Save Defaults.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Set the Open and Save options in Office 2016 apps to default to
4 | # "On My Mac" instead of "Online Locations" in the default user template
5 |
6 | for USER_TEMPLATE in "/System/Library/User Template"/*
7 | do
8 | /usr/bin/defaults write "${USER_TEMPLATE}/Library/Group Containers/UBF8T346G9.Office/"com.microsoft.officeprefs DefaultsToLocalOpenSave -bool true
9 | done
10 |
11 | # Set the Open and Save options in Office 2016 apps to default to
12 | # "On My Mac" instead of "Online Locations" in the user folders
13 | # located in /Users, then fixes the permissions on the affected
14 | # file so that the file is owned by the user folder's owner rather
15 | # than being owned by root.
16 |
17 | for USER_HOME in /Users/*
18 | do
19 | USER_UID=`basename "${USER_HOME}"`
20 | if [ ! "${USER_UID}" = "Shared" ]; then
21 | if [ ! -d "${USER_HOME}/Library/Group Containers/UBF8T346G9.Office" ]; then
22 | /bin/mkdir -p "${USER_HOME}/Library/Group Containers/UBF8T346G9.Office"
23 | /usr/sbin/chown "${USER_UID}" "${USER_HOME}/Library"
24 | /usr/sbin/chown "${USER_UID}" "${USER_HOME}/Library/Group Containers"
25 | /usr/sbin/chown "${USER_UID}" "${USER_HOME}/Library/Group Containers/UBF8T346G9.Office"
26 | fi
27 | if [ -d "${USER_HOME}/Library/Group Containers/UBF8T346G9.Office" ]; then
28 | /usr/bin/defaults write "${USER_HOME}/Library/Group Containers/UBF8T346G9.Office/"com.microsoft.officeprefs DefaultsToLocalOpenSave -bool true
29 | /usr/sbin/chown "${USER_UID}" "${USER_HOME}/Library/Group Containers/UBF8T346G9.Office/"com.microsoft.officeprefs.plist
30 | fi
31 | fi
32 | done
--------------------------------------------------------------------------------
/OpenDNS Certificates.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | /usr/bin/security add-trusted-cert -d -r trustRoot -p ssl -p basic -k /Library/Keychains/System.keychain /var/tmp/Certificates/OpenDNS-Root.crt
3 | /usr/bin/security add-trusted-cert -d -r trustRoot -p ssl -p basic -k /Library/Keychains/System.keychain /var/tmp/Certificates/Cisco_Umbrella_Root_CA.cer
4 | rm -rf /var/tmp/Certificates
--------------------------------------------------------------------------------
/OpenDNS Removal.sh:
--------------------------------------------------------------------------------
1 | #byebyeOpenDNS
2 |
3 | launchctl remove com.opendns.osx.RoamingClientMenubar
4 | launchctl remove com.opendns.osx.RoamingClientConfigUpdater
5 | launchctl remove com.opendns.osx.RoamingClientConfigUpdater
6 |
7 | sleep 5
8 |
9 | for i in '/Library/LaunchDaemons/com.opendns.osx.RoamingClientConfigUpdater.plist' '/Library/LaunchAgents/com.opendns.osx.RoamingClientMenubar.plist' '/Applications/OpenDNS Roaming Client' '/ Library/Application Support/OpenDNS Roaming Client' '/usr/local/sbin/dnscrypt-proxy' '/usr/local/share/man/man8/dnscrypt-proxy.8' '/var/lib/data/opendns' '/usr/local/lib/dnscrypt-proxy'
10 | do rm -fr \"$i\"
11 |
12 | done;
13 |
14 | killall RoamingClientMenubar
15 | killall dnscrypt-proxy
16 |
17 | rm -rf /Library/LaunchAgents/com.opendns.osx.RoamingClientMenubar.plist
18 | rm -rf /Library/LaunchDaemons/com.opendns.osx.RoamingClientConfigUpdater.plist
19 | rm -rf /Library/Application\ Support/OpenDNS\ Roaming\ Client
20 | rm -rf /usr/local/lib/dnscrypt-proxy
21 | rm -rf /Applications/OpenDNS\ Roaming\ Client/
22 |
23 | pkgutil --forget com.opendns.osx.RoamingClient
24 |
--------------------------------------------------------------------------------
/Over Spring Break Sierra Notification.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | OSVers=$(sw_vers | grep "ProductVersion" | cut -d ':' -f 2 | awk -F "." '{print $2}')
4 | if [ $OSVers -lt 12 ]; then
5 |
6 | sierraDialog=$(/Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "Install macOS Sierra" -heading "Your computer is overdue for a major system upgrade." -description "Installation time could exceed one hour, and your computer will NOT be usable during the process. Please connect your power cord, and do not close the lid of the laptop.
7 |
8 | You may postpone installation and upgrade later through Self Service." -button1 "Install Now" -button2 "Postpone" -defaultButton 2 -icon "/usr/local/saes/saesshield.png" -lockHUD)
9 |
10 | if [ $sierraDialog != 0 ]; then
11 | echo "Try again later..."
12 | else
13 | echo "Installing Sierra..."
14 | jamf policy -event SierrraInstall
15 | fi
16 | else
17 | echo $(sw_vers | grep "ProductVersion")
18 | jamf recon
19 | fi
--------------------------------------------------------------------------------
/Quit Relaunch Chrome.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 |
4 | ps ax | grep "/Applications/Google Chrome.app" | awk '{print $1}' | xargs kill -9 2> /dev/null
5 | rm -rf "/Users/$3/Library/Application Support/Google/Chrome"
6 | sleep 3
7 | open "/Applications/Google Chrome.app"
--------------------------------------------------------------------------------
/Quit Web Browsers.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | killall Safari 2> /dev/null
4 | killall firefox 2> /dev/null
5 | killall "Google Chrome" 2> /dev/null
6 | exit 0
7 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # jamfscript
2 | Scripts I use non API related
3 |
4 | Some of these aren't really useful anymore. Some of these are scripts borrowed and edited from around the net. But this is the majority of what I use.
5 |
--------------------------------------------------------------------------------
/Re-Run Office 2011 Setup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | getUser=`ls -l /dev/console | awk '{ print $3 }'`
4 |
5 |
6 | rm -rf /Users/$getUser/Library/Application\ Support/Microsoft/Office
7 | rm -rf /Users/$getUser/Documents/Microsoft\ User\ Data
8 | rm -rf /Users/$getUser/Library/Preferences/com.microsoft.office.plist
9 | rm -rf /Users/$getUser/Library/Preferences/com.microsoft.autoupdate2.plist
10 | rm -rf /Users/$getUser/Library/Preferences/com.microsoft.error_reporting.plist
11 | rm -rf /Users/$getUser/Library/Preferences/com.microsoft.Word.plist
12 |
--------------------------------------------------------------------------------
/Remove Office 2011.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 |
4 | osascript -e 'tell application "Microsoft Database Daemon" to quit'
5 | osascript -e 'tell application "Microsoft AU Daemon" to quit'
6 | osascript -e 'tell application "Office365Service" to quit'
7 | rm -R '/Applications/Microsoft Communicator.app/'
8 | rm -R '/Applications/Microsoft Lync.app/'
9 | rm -R '/Applications/Microsoft Messenger.app/'
10 | rm -R '/Applications/Microsoft Office 2011/'
11 | rm -R '/Applications/Remote Desktop Connection.app/'
12 | rm -R '/Library/Application Support/Microsoft/'
13 | rm -R /Library/Automator/*Excel*
14 | rm -R /Library/Automator/*Office*
15 | rm -R /Library/Automator/*Outlook*
16 | rm -R /Library/Automator/*PowerPoint*
17 | rm -R /Library/Automator/*Word*
18 | rm -R /Library/Automator/*Workbook*
19 | rm -R '/Library/Automator/Get Parent Presentations of Slides.action'
20 | rm -R '/Library/Automator/Set Document Settings.action'
21 | rm -R /Library/Fonts/Microsoft/
22 | mv '/Library/Fonts Disabled/Arial Bold Italic.ttf' /Library/Fonts
23 | mv '/Library/Fonts Disabled/Arial Bold.ttf' /Library/Fonts
24 | mv '/Library/Fonts Disabled/Arial Italic.ttf' /Library/Fonts
25 | mv '/Library/Fonts Disabled/Arial.ttf' /Library/Fonts
26 | mv '/Library/Fonts Disabled/Brush Script.ttf' /Library/Fonts
27 | mv '/Library/Fonts Disabled/Times New Roman Bold Italic.ttf' /Library/Fonts
28 | mv '/Library/Fonts Disabled/Times New Roman Bold.ttf' /Library/Fonts
29 | mv '/Library/Fonts Disabled/Times New Roman Italic.ttf' /Library/Fonts
30 | mv '/Library/Fonts Disabled/Times New Roman.ttf' /Library/Fonts
31 | mv '/Library/Fonts Disabled/Verdana Bold Italic.ttf' /Library/Fonts
32 | mv '/Library/Fonts Disabled/Verdana Bold.ttf' /Library/Fonts
33 | mv '/Library/Fonts Disabled/Verdana Italic.ttf' /Library/Fonts
34 | mv '/Library/Fonts Disabled/Verdana.ttf' /Library/Fonts
35 | mv '/Library/Fonts Disabled/Wingdings 2.ttf' /Library/Fonts
36 | mv '/Library/Fonts Disabled/Wingdings 3.ttf' /Library/Fonts
37 | mv '/Library/Fonts Disabled/Wingdings.ttf' /Library/Fonts
38 | rm -R /Library/Internet\ Plug-Ins/SharePoint*
39 | rm -R /Library/LaunchDaemons/com.microsoft.office.licensing.helper.plist
40 | rm -R /Library/Preferences/com.microsoft.office.licensing.plist
41 | rm -R /Library/PrivilegedHelperTools/com.microsoft.office.licensing.helper
42 | OFFICERECEIPTS=$(pkgutil --pkgs=com.microsoft.office.*)
43 | for ARECEIPT in $OFFICERECEIPTS
44 | do
45 | pkgutil --forget $ARECEIPT
46 | done
47 | rm -R '/Library/Application Support/Microsoft/MAU2.0'
48 |
49 | exit 0
--------------------------------------------------------------------------------
/Remove OpenDNS.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | launchctl remove com.opendns.osx.RoamingClientMenubar
4 | launchctl remove com.opendns.osx.RoamingClientConfigUpdater
5 | launchctl remove com.opendns.osx.RoamingClientConfigUpdater
6 |
7 | sleep 5
8 |
9 | for i in '/Library/LaunchDaemons/com.opendns.osx.RoamingClientConfigUpdater.plist' '/Library/LaunchAgents/com.opendns.osx.RoamingClientMenubar.plist' '/Applications/OpenDNS Roaming Client' '/ Library/Application Support/OpenDNS Roaming Client' '/usr/local/sbin/dnscrypt-proxy' '/usr/local/share/man/man8/dnscrypt-proxy.8' '/var/lib/data/opendns' '/usr/local/lib/dnscrypt-proxy'
10 | do rm -fr \"$i\"
11 |
12 | done;
13 |
14 | killall RoamingClientMenubar
15 | killall dnscrypt-proxy
16 |
17 | rm -rf /Library/LaunchAgents/com.opendns.osx.RoamingClientMenubar.plist
18 | rm -rf /Library/LaunchDaemons/com.opendns.osx.RoamingClientConfigUpdater.plist
19 | rm -rf /Library/Application\ Support/OpenDNS\ Roaming\ Client
20 | rm -rf /usr/local/lib/dnscrypt-proxy
21 | rm -rf /Applications/OpenDNS\ Roaming\ Client/
22 |
23 | pkgutil --forget com.opendns.osx.RoamingClient
24 |
--------------------------------------------------------------------------------
/Remove Pages-Numbers-Keynote-GarageBand.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | rm -rf /Applications/Pages.app
4 | rm -rf /Applications/Numbers.app
5 | rm -rf /Applications/Keynote.app
6 | rm -rf /Applications/GarageBand.app
--------------------------------------------------------------------------------
/Remove SAES Network from Students.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | Adapter=en0
4 |
5 | FoundGuest=`networksetup -listpreferredwirelessnetworks $Adapter | grep "S.A.E.S." | grep -v "S.A.E.S. Students"`
6 |
7 | if [ "$FoundGuest" == ' S.A.E.S.' ]; then
8 | ConnectedtoGuest=`networksetup -getairportnetwork $Adapter | awk '{ print $4 " "$5 }'`
9 | if [ "$ConnectedtoGuest" == 'S.A.E.S. ' ]; then
10 | #Gotta disconnect first to remove it
11 | networksetup -setairportpower $Adapter off
12 | networksetup -removepreferredwirelessnetwork $Adapter "S.A.E.S."
13 | sleep 1
14 | networksetup -setairportpower $Adapter on
15 | else
16 | networksetup -removepreferredwirelessnetwork $Adapter "S.A.E.S."
17 | fi
18 | fi
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Remove SAES Temp Closed Network.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | networksetup -removepreferredwirelessnetwork en0 SAES-Temp-Closed
4 | networksetup -setairportpower en0 off
5 | sleep 1
6 | networksetup -setairportpower en0 on
--------------------------------------------------------------------------------
/Remove Silverlight.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | rm -rf /Library/Internet\ Plug-Ins/Silverlight.plugin
4 |
--------------------------------------------------------------------------------
/Remove Smart Junk.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | rm -rf /Library/LaunchAgents/com.smarttech.floatingtools.plist
4 | rm -rf /Library/LaunchAgents/com.smarttech.responseconnectorservice.plist
5 | rm -rf /Library/LaunchAgents/com.smarttech.responsedesktopmenu.plist
6 | mv /Applications/SMART\ Technologies/SMART\ Tools/Floating\ Tools.app /Applications/SMART\ Technologies/SMART\ Tools/Floating\ Tools2.app
7 |
--------------------------------------------------------------------------------
/Remove iOS Printers.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | lpadmin -x b_0o8_L_Color_Copierb_0o8____Printopia_Pro
4 | lpadmin -x b_0o8_L_Kindergartenb_0o8____Printopia_Pro
5 | lpadmin -x b_0o8_L_2nd_Gradeb_0o8____Printopia_Pro
6 | exit 0
7 |
--------------------------------------------------------------------------------
/RemoveGuest - LaunchDeamon.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #Sets up a script and creates a launchdeamon that watches com.apple.airport.preferences.plist
4 | #This changes whenever you join a network. If the Guest network is joined, then remove it and bop them off of it
5 |
6 | sciptLocation="/usr/local/"
7 | scriptName="removeGuest.sh"
8 | yourCompany="MyCompany"
9 |
10 | ##################
11 | ##CREATE SCRIPT###
12 | ##################
13 | cat << EOF > ${scriptLocation}${scriptName}
14 | #!/bin/bash
15 |
16 | #set interface name and network you're hunting for
17 | interfaceName="Wi-Fi"
18 | networkName="GUEST"
19 |
20 | Adapter=\$(networksetup -listallhardwareports | grep -A 1 "\$interfaceName" | grep Device | awk '{print \$2}')
21 |
22 | if networksetup -listpreferredwirelessnetworks \$Adapter | grep "\$networkName"; then
23 | echo "Guest Found"
24 | ConnectedtoGuest=\$(networksetup -getairportnetwork \$Adapter | awk -F ":" '{ print \$2 }' | cut -c 2-)
25 | if [ "\$ConnectedtoGuest" == "\$networkName" ]; then
26 | #Gotta disconnect first to remove it
27 | networksetup -setairportpower \$Adapter off
28 | networksetup -removepreferredwirelessnetwork \$Adapter "\$networkName"
29 | networksetup -setairportpower \$Adapter on
30 |
31 | else
32 | networksetup -removepreferredwirelessnetwork \$Adapter "\$networkName"
33 |
34 | fi
35 | fi
36 |
37 | EOF
38 |
39 | ########################
40 | ##CREATE LAUNCHDAEMON###
41 | ########################
42 |
43 | cat << EOF > /Library/LaunchDaemons/com.${yourCompany}.removeguest.plist
44 |
45 |
46 |
47 |
48 | Label
49 | com.${yourCompany}.removeguest2
50 | ProgramArguments
51 |
52 | sh
53 | -c
54 | ${scriptLocation}${scriptName}
55 |
56 | WatchPaths
57 |
58 | /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
59 |
60 |
61 |
62 |
63 | EOF
64 |
65 | chown root:wheel ${scriptLocation}${scriptName}
66 | chmod 755 ${scriptLocation}${scriptName}
67 |
68 | chown root:wheel /Library/LaunchDaemons/com.$yourCompany.removeguest.plist
69 | chmod 644 /Library/LaunchDaemons/com.$yourCompany.removeguest.plist
70 |
71 | launchctl load -w /Library/LaunchDaemons/com.$yourCompany.removeguest.plist
72 |
--------------------------------------------------------------------------------
/RemoveGuest.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | Adapter=en0
4 |
5 | FoundGuest=`networksetup -listpreferredwirelessnetworks $Adapter | grep "SAES Guest Wifi"`
6 |
7 | if [ "$FoundGuest" == ' SAES Guest Wifi' ]; then
8 | ConnectedtoGuest=`networksetup -getairportnetwork $Adapter | awk '{ print $4 }'`
9 | if [ "$ConnectedtoGuest" == 'SAES Guest Wifi' ]; then
10 | #Gotta disconnect first to remove it
11 | networksetup -setairportpower $Adapter off
12 | networksetup -removepreferredwirelessnetwork $Adapter "SAES Guest Wifi"
13 | networksetup -setairportpower $Adapter on
14 | else
15 | networksetup -removepreferredwirelessnetwork $Adapter "SAES Guest Wifi"
16 | fi
17 | fi
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Reset PRAM.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | nvram boot-args="-p -r"
4 | nvram -c
5 |
--------------------------------------------------------------------------------
/Reset Print System.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | launchctl stop org.cups.cupsd
4 | mv /etc/cups/cupsd.conf /etc/cups/cupsd.conf.backup
5 | cp /etc/cups/cupsd.conf.default /etc/cups/cupsd.conf
6 | mv /etc/cups/printers.conf /etc/cups/printers.conf.backup
7 | launchctl start org.cups.cupsd
8 |
--------------------------------------------------------------------------------
/Set Faculty and Staff Admin.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 |
4 | getUser=`ls -l /dev/console | awk '{ print $3 }'`
5 |
6 | dseditgroup -o edit -a $getUser -T group admin
7 |
--------------------------------------------------------------------------------
/Set Location Services and Time Zone etc.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Use "/usr/sbin/systemsetup -listtimezones" to see a list of available list time zones.
4 | TimeZone="America/New_York"
5 | TimeServer="time.apple.com"
6 |
7 | ############# Pause for network services #############
8 | /bin/sleep 10
9 | #################################################
10 |
11 | /usr/sbin/systemsetup -setusingnetworktime off
12 |
13 | #Set an initial time zone
14 | /usr/sbin/systemsetup -settimezone $TimeZone
15 |
16 | #Set specific time server
17 | /usr/sbin/systemsetup -setnetworktimeserver $TimeServer
18 |
19 | # enable location services
20 | /bin/launchctl unload /System/Library/LaunchDaemons/com.apple.locationd.plist
21 | uuid=`/usr/sbin/system_profiler SPHardwareDataType | grep "Hardware UUID" | cut -c22-57`
22 | /usr/bin/defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd.$uuid LocationServicesEnabled -int 1
23 | /usr/sbin/chown -R _locationd:_locationd /var/db/locationd
24 | /bin/launchctl load /System/Library/LaunchDaemons/com.apple.locationd.plist
25 |
26 | # set time zone automatically using current location
27 | /usr/bin/defaults write /Library/Preferences/com.apple.timezone.auto Active -bool true
28 |
29 | /usr/sbin/systemsetup -setusingnetworktime on
30 |
31 | /usr/sbin/systemsetup -gettimezone
32 | /usr/sbin/systemsetup -getnetworktimeserver
33 |
34 | exit 0
--------------------------------------------------------------------------------
/Set Office Name Info.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | killall "Microsoft Word"
4 | killall "Microsoft Excel"
5 | killall "Microsoft PowerPoint"
6 |
7 | getUser=`ls -l /dev/console | awk '{ print $3 }'`
8 |
9 | RealName=`dscl '/Active Directory/ACADEMIC/All Domains' -read /Users/$getUser RealName | grep -v ":"`
10 | RealRealName=`echo $RealName | awk '{ print $1 " " $3}'`
11 | FirstLastInitial=`echo $RealName | awk '{ print $1 }' | cut -c 1 ; echo $RealName | awk '{ print $3 }' | cut -c 1`
12 | FirstLastInitial=`echo $FirstLastInitial | cut -c 1,3`
13 |
14 | defaults write com.microsoft.office "14\UserInfo\UserInitials" -string "$FirstLastInitial"
15 | defaults write com.microsoft.office "14\UserInfo\UserName" -string "$RealRealName"
16 | defaults write "/Users/$getUser/Library/Application Support/Microsoft/Office/MeContact.plist" "First Name" -string `echo $RealName | awk '{ print $1}'`
17 | defaults write "/Users/$getUser/Library/Application Support/Microsoft/Office/MeContact.plist" "Last Name" -string `echo $RealName | awk '{ print $3}'`
18 | defaults write "/Users/$getUser/Library/Application Support/Microsoft/Office/MeContact.plist" Name -string "$RealRealName"
19 | defaults write "/Users/$getUser/Library/Application Support/Microsoft/Office/MeContact.plist" Initials -string "$FirstLastInitial"
20 | defaults write "/Users/$getUser/Library/Application Support/Microsoft/Office/MeContact.plist" "Business Company" -string "St. Andrew's Episcopal School"
21 |
--------------------------------------------------------------------------------
/Set Office User Script.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | ## postinstall
3 |
4 | pathToScript=$0
5 | pathToPackage=$1
6 | targetLocation=$2
7 | targetVolume=$3
8 |
9 | getUser=`ls -l /dev/console | awk '{ print $3 }'`
10 |
11 | RealName=`dscl '/Active Directory/ACADEMIC/All Domains' -read /Users/$getUser RealName | grep -v ":"`
12 | RealRealName=`echo $RealName | awk '{ print $1 " " $3}'`
13 | FirstLastInitial=`echo $RealName | awk '{ print $1 }' | cut -c 1 ; echo $RealName | awk '{ print $3 }' | cut -c 1`
14 | FirstLastInitial=`echo $FirstLastInitial | cut -c 1,3`
15 |
16 |
17 | #mv "/private/var/tmp/Office\ Temp/Application\ Support/Microsoft" "/Users/$getUser/Library/Application Support/"
18 | #mv "/private/var/tmp/Office Temp/Preferences"/* "/Users/$getUser/Library/Preferences/"
19 | #mv "/private/var/tmp/Office Temp/Documents/Microsoft User Data" "/Users/$getUser/Documents/"
20 |
21 |
22 | defaults write com.microsoft.office "14\UserInfo\UserInitials" -string "$FirstLastInitial"
23 | defaults write com.microsoft.office "14\UserInfo\UserName" -string "$RealRealName"
24 | defaults write "/Users/$getUser/Library/Application Support/Microsoft/Office/MeContact.plist" "First Name" -string `echo $RealName | awk '{ print $1}'`
25 | #defaults write "/Users/$getUser/Library/Application Support/Microsoft/Office/MeContact.plist" "Last Name" -string `echo $RealName | awk '{ print $3}'`
26 | defaults write "/Users/$getUser/Library/Application Support/Microsoft/Office/MeContact.plist" Name -string "$RealRealName"
27 | defaults write "/Users/$getUser/Library/Application Support/Microsoft/Office/MeContact.plist" Initials -string "$FirstLastInitial"
28 | defaults write "/Users/$getUser/Library/Application Support/Microsoft/Office/MeContact.plist" "Business Company" -string "St. Andrew's Episcopal School"
29 |
30 | #chown -R $getUser /Users/$getUser
31 |
32 |
33 |
34 | exit 0 ## Success
35 | exit 1 ## Failure
36 |
--------------------------------------------------------------------------------
/Set Startup Disk.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | StartupDisk=`systemsetup -liststartupdisks`
4 | systemsetup -setstartupdisk $StartupDisk
--------------------------------------------------------------------------------
/Setup CrashPlan.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #installs and sets up CP on machines that don't have it installed
4 | #downloads crashplan
5 | #Crashplan download link is found in the crashplan server App Downloads ---> Download App link
6 | #input URL into policy option 4
7 | #writes configuration file deployment property based off of student or technology or faculty/staff
8 | #installs CP
9 |
10 | CurrentUser=$3
11 | CrashPlanURL=$4
12 |
13 | curl -k -s "$CrashPlanURL" > /var/tmp/CP.dmg
14 |
15 | mkdir "/Library/Application Support/CrashPlan/"
16 | chmod -R 775 "/Library/Application Support/CrashPlan/"
17 |
18 | if id "$CurrentUser" | grep "Students"; then
19 | #Student Key
20 | cat <"/Library/Application Support/CrashPlan/deploy.properties"
21 | DEPLOYMENT_URL=CRASHPLAN URL
22 | DEPLOYMENT_POLICY_TOKEN=ENTER TOKEN
23 | CP_SILENT=false
24 | SSL_WHITELIST=ENTER SSL WHITELIST
25 | EOF
26 | elif id "$CurrentUser" | grep "Tech"; then
27 | #Technology Key
28 | cat <"/Library/Application Support/CrashPlan/deploy.properties"
29 | DEPLOYMENT_URL=CRASHPLAN URL
30 | DEPLOYMENT_POLICY_TOKEN=ENTER TOKEN
31 | CP_SILENT=false
32 | SSL_WHITELIST=ENTER SSL WHITELIST
33 | EOF
34 | else
35 | #Faculty & Staff Key
36 | cat <"/Library/Application Support/CrashPlan/deploy.properties"
37 | DEPLOYMENT_URL=CRASHPLAN URL
38 | DEPLOYMENT_POLICY_TOKEN=ENTER TOKEN
39 | CP_SILENT=false
40 | SSL_WHITELIST=ENTER SSL WHITELIST
41 | EOF
42 | fi
43 |
44 | chmod 777 "/Library/Application Support/CrashPlan/deploy.properties"
45 |
46 | hdiutil attach "/var/tmp/CP.dmg" -noverify -nobrowse -quiet
47 | installer -package "/Volumes/Code42CrashPlan/Install Code42 CrashPlan.pkg" -target LocalSystem
48 | hdiutil detach /Volumes/Code42CrashPlan
49 |
50 | rm -rf /var/tmp/CP.dmg
51 |
--------------------------------------------------------------------------------
/Sierra Conditions and Install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | OS=$(sw_vers -productVersion | cut -c 1-5)
4 |
5 | if [ "$OS" = "10.12" ]; then
6 | /usr/local/bin/jamf recon
7 | /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "Sierra Installed" -description "mac OS Siera is already installed" -button1 "Ok" -icon "/Applications/Utilities/System Information.app/Contents/Resources/SystemLogo.tiff" -defaultButton 1 &
8 | echo "10.12 already installed"
9 | ps ax | grep "/Applications/SAES Self Service.app" | awk '{print $1}' | xargs kill -9 2> /dev/null
10 | exit 0
11 | fi
12 |
13 |
14 | StorageAvail=$(df -H / | tail -1 | awk '{print $4}' | tr -d "G")
15 |
16 | if [ $StorageAvail -lt 10 ]; then
17 | jamf displayMessage -message "Your computer does not have enough space. You have only $(df -H / | tail -1 | awk '{print $4}') GB of space free. If you need help making room, please visit the Technology Office."
18 | echo "Not enough storage space"
19 | exit 0
20 | fi
21 |
22 |
23 | if [ ! -d "/Applications/Install macOS Sierra.app" ]; then
24 | /usr/local/bin/jamf policy -event sierraAppCache &
25 | /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "Sierra Not Cached" -description "mac OS Sirra was not cached, please check back soon." -button1 "Ok" -icon "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/Bonjour.icns" -defaultButton 1 &
26 | echo "not cached"
27 | ps ax | grep "/Applications/SAES Self Service.app" | awk '{print $1}' | xargs kill -9 2> /dev/null
28 | exit 0
29 | fi
30 |
31 |
32 | PluggedInYN=$(pmset -g ps | grep "Power" | cut -c 18- | tr -d "'")
33 | if [ "$PluggedInYN" = "AC Power" ]; then
34 | /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "Installing macOS Sierra" -description "mac OS Sierra will begin installing momentarily.
35 |
36 | Please save all work NOW as all unsaved work will be LOST." -button1 "Ok" -icon "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/Sync.icns" -defaultButton 1 &
37 | /Applications/Install\ macOS\ Sierra.app/Contents/Resources/startosinstall --applicationpath "/Applications/Install macOS Sierra.app" --volume $1 --rebootdelay 30 --nointeraction
38 | echo "plugged in"
39 | killall "Self Service"
40 | exit 0
41 | else
42 | BatteryPercentage=$(pmset -g ps | tail -1 | awk -F ";" '{print $1}' | awk -F "\t" '{print $2}' | tr -d "%")
43 | if [ $BatteryPercentage -ge 50 ]; then
44 | /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "Installing macOS Sierra" -description "mac OS Sierra will begin installing momentarily.
45 |
46 | Please save all work NOW as all unsaved work will be LOST." -button1 "Ok" -icon "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/Sync.icns" -defaultButton 1 &
47 | /Applications/Install\ macOS\ Sierra.app/Contents/Resources/startosinstall --applicationpath "/Applications/Install macOS Sierra.app" --volume $1 --rebootdelay 30 --nointeraction
48 | echo "laptop over 50% power"
49 | killall "Self Service"
50 | exit 0
51 | else
52 | jamf displayMessage -message "Please plug your laptop in while installing. You do not have enough power to install macOS Sierra. You have $BatteryPercentage% power left"
53 | echo "not enough juice"
54 | exit 0
55 | fi
56 | fi
--------------------------------------------------------------------------------
/Sierra Notification.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | SierraOrNot=`system_profiler SPSoftwareDataType | grep macOS | cut -d : -f 2 | cut -c 8-12`
4 |
5 | if [ "$SierraOrNot" = "10.12" ]; then
6 | jamf -recon
7 | else
8 | /var/tmp/CocoaDialog.app/Contents/MacOS/CocoaDialog bubble --no-timeout --title "Upgrade to macOS Sierra" --text "Please upgrade to macOS Sierra found in Self Service.Thank you, Tech" --x-placement center --y-placement center --icon "info"
9 | open "/Applications/SAES Self Service.app"
10 | fi
11 |
12 |
--------------------------------------------------------------------------------
/Sierra Previously Cached.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | if [ -a "/Library/Application Support/JAMF/Waiting Room/Install macOS Sierra.InstallESD.dmg" ]; then
4 | rm -rf "/Library/Application Support/JAMF/Waiting Room/Install macOS Sierra.InstallESD.dmg"
5 | rm -rf "/Library/Application Support/JAMF/Waiting Room/Install macOS Sierra.InstallESD.dmg.cache.xml"
6 | /usr/local/jamf/bin/jamf recon
7 | fi
8 |
--------------------------------------------------------------------------------
/Skype Install Script.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir /tmp/getmacapps_temp
4 | cd /tmp/getmacapps_temp
5 |
6 | # Installing Skype
7 | curl -L -O "http://www.skype.com/go/getskype-macosx.dmg"
8 | hdiutil mount -nobrowse getskype-macosx.dmg
9 | rsync -vaz /Volumes/Skype/Skype.app/ /Applications/Skype.app
10 | hdiutil unmount "/Volumes/Skype"
11 | rm getskype-macosx.dmg
12 |
13 | #From GetMacApps.com
--------------------------------------------------------------------------------
/SoftwareUpdateFrequency.sh.sh:
--------------------------------------------------------------------------------
1 | #/bin/bash
2 |
3 | /usr/bin/defaults write /Library/Preferences/com.apple.SoftwareUpdate AutomaticCheckEnabled -bool TRUE
4 | /usr/bin/defaults write /Library/Preferences/com.apple.commerce AutoUpdate -bool TRUE
5 | /usr/bin/defaults write /Library/Preferences/com.apple.commerce AutoUpdateRestartRequired -bool FALSE
--------------------------------------------------------------------------------
/StudentIcon.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 |
4 | sudo dscl . -change /Users/student Picture '/Library/User Pictures/Fun/Chalk.tif' '/Library/User Pictures/Fun/SAESstudent.png'
5 |
--------------------------------------------------------------------------------
/Testing - UnLock.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | mv /System/Library/Services/AppleSpell.service/Contents/Resources.disabled /System/Library/Services/AppleSpell.service/Contents/Resources
4 | profiles -R -F "/var/tmp/Testing - Lockdown.mobileconfig"
--------------------------------------------------------------------------------
/Testing Lockdown.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | /usr/bin/profiles -I -F "/var/tmp/Testing - Lockdown.mobileconfig"
4 | mv /System/Library/Services/AppleSpell.service/ /System/Library/Services/AppleSpell.service.disabled
5 | killall AppleSpell
6 | /Applications/TextEdit.app/Contents/MacOS/TextEdit
7 | killall Dock
--------------------------------------------------------------------------------
/Trust Microsoft AU Daemon.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if [ -e "/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app" ]
4 | then
5 | sudo -u $3 /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -R -f -trusted "/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app"
6 | /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -R -f -trusted "/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app"
7 | fi
8 |
9 | if [ -e "/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app/Contents/MacOS/Microsoft AU Daemon.app" ]
10 | then
11 | sudo -u $3 /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -R -f -trusted "/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app/Contents/MacOS/Microsoft AU Daemon.app"
12 | /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -R -f -trusted "/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app/Contents/MacOS/Microsoft AU Daemon.app"
13 | fi
--------------------------------------------------------------------------------
/Uninstall CrashPlan.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # CrashPlan Uninstall script.
3 |
4 | _cleanAppSupport() {
5 | local appSupportFolder="$1"
6 | local installedAsUser="$2"
7 | for file in `ls -A "$appSupportFolder"`; do
8 | deleteFile=true
9 | # retain .identity
10 | if [ ".identity" == "$file" ]; then
11 | deleteFile=false
12 | # strip out the keys
13 | identityFile="$appSupportFolder"/.identity
14 | if [ "$installedAsUser" = "true" ]; then
15 | sed -e '/dataKey/ d' -e '/secureDataKey/ d' -e '/privateKey/ d' -e '/publicKey/ d' -e '/securityKeyType/ d' -e '/offlinePasswordHash/ d' "$identityFile" > "${identityFile}.tmp"
16 | mv "${identityFile}.tmp" "$identityFile"
17 | chmod 600 "$identityFile"
18 | else
19 | sudo sed -e '/dataKey/ d' -e '/secureDataKey/ d' -e '/privateKey/ d' -e '/publicKey/ d' -e '/securityKeyType/ d' -e '/offlinePasswordHash/ d' "$identityFile" > "${identityFile}.tmp"
20 | sudo mv "${identityFile}.tmp" "$identityFile"
21 | sudo chmod 600 "$identityFile"
22 | fi
23 | # If the user is an installed as root but running as user, we'll still need sudo to do stuff.
24 | if [ "$runAsRoot" != "true" ] && [ "$installedAsUser" != "true" ]; then
25 | installingGroup=`id -gn $installingUser`
26 | sudo chown $installingUser:$installingGroup "$identityFile"
27 | fi
28 | fi
29 |
30 | # Retain non-empty backupArchives or PROServer folders.
31 | if [ "PROServer" == "$file" ] || [ "backupArchives" == "$file" ]; then
32 | # If folder has data, do not delete it
33 | if [ 0 -lt `ls -lA "$appSupportFolder/$file" | wc -l` ]; then
34 | deleteFile=false
35 | fi
36 | fi
37 |
38 | if [ "true" = "$deleteFile" ]; then
39 | if [ "$installedAsUser" = "true" ]; then
40 | rm -Rfv "$appSupportFolder/$file"
41 | else
42 | sudo rm -Rfv "$appSupportFolder/$file"
43 | fi
44 | fi
45 | done
46 | }
47 |
48 |
49 | # These are default values that will be overridden if the installVarsFile is sourced.
50 | # So do not rename these unless you get all the other scripts that depend on them.
51 | runAsRoot=true
52 | enginePlist="/Library/LaunchDaemons/com.crashplan.engine.plist"
53 | installingUser=`id -un`
54 |
55 | # Check the user install first, we'll call it a user install if either they've got an
56 | # installVarsFile or they're calling it from inside their own App support directory.
57 | appSupportDir="/Library/Application Support/CrashPlan"
58 | installVarsFile="${appSupportDir}/install.vars"
59 | if [ -f "$HOME/$installVarsFile" ] && [ -d "$HOME/$appSupportDir" ]; then
60 | source "$HOME/$installVarsFile"
61 | installedAsUser=true
62 | export logFile="$HOME/Library/Logs/crashplan_uninstall.log"
63 | echo "`date` : User install detected, uninstalling as user." >> $logFile 2>&1
64 | elif [ -f "$installVarsFile" ] && [ -d "$appSupportDir" ]; then
65 | source "$installVarsFile"
66 | export logFile="/Library/Logs/crashplan_uninstall.log"
67 | echo "`date` : Root install detected, uninstalling as administrator." >> $logFile 2>&1
68 | fi
69 |
70 | echo "`date` : NOTICE: This will remove CrashPlan software and configuration information." >> $logFile 2>&1
71 | echo "`date` : NOTICE: Automatic backup will cease." >> $logFile 2>&1
72 | echo "`date` : NOTICE: Backup archives from other computers will NOT be deleted." >> $logFile 2>&1
73 |
74 | #
75 | # When the engine is running as the user, it maybe running in either the global launchd or in the
76 | # installing users launchd process. We need to check for both.
77 | #
78 |
79 | if [ -f "$HOME/$appSupportDir/unloadEngine.sh" ]; then
80 | source "$HOME/$appSupportDir/unloadEngine.sh"
81 | else
82 | source "$appSupportDir/unloadEngine.sh"
83 | fi
84 |
85 |
86 |
87 | if [ "$installedAsUser" = "true" ]; then
88 |
89 | # kill the menu bar
90 | echo "`date` : Killing the menu bar app." >> $logFile 2>&1
91 | killall -9 "${menuBarAppName}" >> $logFile 2>&1
92 |
93 |
94 | if [ -e "${HOME}/Library/LaunchAgents/com.crashplan.engine.plist" ]; then
95 | # This handles the case where the user is not admin and can't do sudo
96 | echo "`date` : Removing the launcher from my Library/LaunchAgents folder..." >> $logFile 2>&1
97 | rm -fv "${HOME}/Library/LaunchAgents/com.crashplan.engine.plist" >> $logFile 2>&1
98 | rm -fv "${HOME}/Library/LaunchAgents/com.crashplan.cleanup.plist" >> $logFile 2>&1
99 | fi
100 |
101 | echo "`date` : Removing the application files..." >> $logFile 2>&1
102 |
103 | chflags noschg $HOME/Applications/CrashPlan.app >> $logFile 2>&1
104 |
105 | # Delete the whole CrashPlan.app directory.
106 | rm -Rfv $HOME/Applications/CrashPlan.app >> $logFile 2>&1
107 |
108 | # These folders need to be deleted regardless
109 | echo "`date` : Removing the supporting files and directories..." >> $logFile 2>&1
110 |
111 | #
112 | # Clean up the /Library/Application Support/CrashPlan folder.
113 | # But leave non-empty backupArchives or PROServer folders.
114 | #
115 | _cleanAppSupport "$HOME/Library/Application Support/CrashPlan" true >> $logFile 2>&1
116 |
117 | rm -Rfv $HOME/Library/Logs/CrashPlan >> $logFile 2>&1
118 | rm -Rfv $HOME/Library/Caches/CrashPlan >> $logFile 2>&1
119 | rm -Rfv $HOME/Library/Receipts/*CrashPlan* >> $logFile 2>&1
120 | pkgutil --forget com.crashplan >> $logFile 2>&1
121 |
122 | else
123 | # kill the menu bar
124 | echo "`date` : Killing the menu bar app." >> $logFile 2>&1
125 | killall -9 "${menuBarAppName}"
126 |
127 | echo
128 | if [ -e "${HOME}/Library/LaunchAgents/com.crashplan.engine.plist" ]; then
129 | # This handles the case where the user is not admin and can't do sudo
130 | echo "`date` : Removing the launcher from my Library/LaunchAgents folder..." >> $logFile 2>&1
131 | rm -fv "${HOME}/Library/LaunchAgents/com.crashplan.engine.plist"
132 | rm -fv "${HOME}/Library/LaunchAgents/com.crashplan.cleanup.plist"
133 | fi
134 | if [ -e "$enginePlist" ]; then
135 | echo "`date` : Removing the backup engine launcher ..." >> $logFile 2>&1
136 | sudo rm -fv "$enginePlist"
137 | fi
138 | if [ -e "/Library/LaunchDaemons/com.crashplan.engine.plist" ]; then
139 | echo "`date` : Removing an old Launcher from the /Library/LaunchDaemons folder..." >> $logFile 2>&1
140 | sudo rm -fv /Library/LaunchDaemons/com.crashplan.engine.plist
141 | fi
142 |
143 | echo "`date` : Removing the application files..." >> $logFile 2>&1
144 |
145 | sudo chflags noschg /Applications/CrashPlan.app
146 |
147 | # Delete the whole CrashPlan.app directory.
148 | sudo rm -Rfv /Applications/CrashPlan.app >> $logFile 2>&1
149 |
150 | # These folders need to be deleted regardless
151 | echo "`date` : Removing the supporting files and directories..." >> $logFile 2>&1
152 |
153 | #
154 | # Clean up the /Library/Application Support/CrashPlan folder.
155 | # But leave non-empty backupArchives or PROServer folders.
156 | #
157 | _cleanAppSupport "/Library/Application Support/CrashPlan" >> $logFile 2>&1
158 |
159 | sudo rm -Rfv /Library/Logs/CrashPlan
160 | sudo rm -Rfv /Library/Caches/CrashPlan
161 | sudo rm -Rfv /Library/Receipts/*CrashPlan*
162 | sudo rm -Rfv /Library/Receipts/*RunAsUser.pkg
163 | sudo pkgutil --forget com.crashplan
164 |
165 | # These were left around by old installers
166 | sudo rm -fv /var/log/cp-*.log
167 |
168 | # Remove stuff some old installers left in the /Resources directory
169 | if [ -e /Resources ]; then
170 | sudo rm -fv /Resources/post*
171 | sudo rm -fv /Resources/pre*
172 | sudo rm -fv /Resources/CrashPlan*
173 | # If /Resources is empty then delete it.
174 | if [ 0 = `ls -A /Resources | wc -l` ]; then
175 | sudo rm -Rfv /Resources
176 | fi
177 | fi
178 |
179 | if [ -f "$installVarsFile" ]; then
180 | # Doing this can cause the user based .identity file to incorrectly change permissions to root.
181 | echo "`date` : Looking for CrashPlan files and folders in users home folders..." >> $logFile 2>&1
182 | for u in `ls /Users`; do
183 | if [ -e "/Users/${u}/Library/Preferences/" ]; then
184 | sudo rm -fv /Users/"${u}"/Library/Preferences/*backup42*plist >> $logFile 2>&1
185 | sudo rm -fv /Users/"${u}"/Library/Preferences/*crashplan*plist >> $logFile 2>&1
186 | fi
187 | folder="/Users/${u}/Library/Application Support/CrashPlan"
188 | if [ -e "$folder" ]; then
189 | echo "`date` : Cleaning out $folder" >> $logFile 2>&1
190 | _cleanAppSupport "$folder" >> $logFile 2>&1
191 | fi
192 | done
193 | else
194 | echo "`date` : Missing install.vars, skipping users." >> $logFile 2>&1
195 | fi
196 |
197 | fi
198 | echo "`date` : NOTICE: CrashPlan has been uninstalled." >> $logFile 2>&1
199 | echo "`date` : NOTICE: Backup archives from other computers have not been deleted." >> $logFile 2>&1
200 |
201 | rm -rf "/Library/Application Support/CrashPlan"
--------------------------------------------------------------------------------
/Update everything.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | softwareupdate -i -a
4 |
--------------------------------------------------------------------------------
/VLC Install Script.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir /tmp/downloads
4 | cd /tmp/downloads
5 |
6 | # Installing VLC Player
7 | CurrentVLC=$(curl -s "http://get.videolan.org/vlc/last/macosx/" | grep .dmg | awk -F '"' '/.dmg/{print $2}' | grep -v "dmg.")
8 |
9 | curl -s -L -o vlc.dmg http://get.videolan.org/vlc/last/macosx/$CurrentVLC
10 |
11 | hdiutil mount -quiet -nobrowse vlc.dmg -mountpoint /Volumes/vlc
12 | rsync -vazq /Volumes/vlc/VLC.app/ /Applications/VLC.app
13 | hdiutil unmount "/Volumes/vlc"
14 | rm vlc.dmg
15 | rm -rf /tmp/downloads
16 |
--------------------------------------------------------------------------------
/backup-scan.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | /Applications/CrashPlan.app/Contents/Resources/Java/bin/cli.sh backup.scan
4 |
--------------------------------------------------------------------------------
/boardtoolsremoval.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | rm -f /Library/LaunchAgents/com.smarttech.boardtools.plist
--------------------------------------------------------------------------------
/byebyeDash.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | getUser=`ls -l /dev/console | awk '{ print $3 }'`
4 | defaults write /Users/$getUser/Library/Preferences/com.apple.dashboard mcx-disabled -boolean YES
5 | sudo -u $getUser killall Dock
6 |
--------------------------------------------------------------------------------
/crashplanOpenClose.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | osascript -e 'tell application "CrashPlan" to activate
tell application "Finder" to set visible of process "CrashPlan" to false
delay 12
tell application "CrashPlan" to quit'
4 |
5 | open "/Applications/CrashPlan.app/Contents/Resources/CrashPlan menu bar.app"
--------------------------------------------------------------------------------
/directory_service_available.scrpt:
--------------------------------------------------------------------------------
1 | #!/usr/bin/osascript -l JavaScript
2 |
3 | ObjC.import('OpenDirectory')
4 |
5 | function run() {
6 | var session = $.ODSession.defaultSession;
7 | var nodes = ObjC.unwrap(session.nodeNamesAndReturnError(null));
8 | var EA = ""
9 | for (node of nodes){
10 | var odnode = $.ODNode;
11 | var result = ObjC.unwrap(odnode.nodeWithSessionNameError(session,node,null));
12 |
13 | if( result ){
14 | EA += ObjC.unwrap(node) + " is available.\n"
15 | } else {
16 | EA += ObjC.unwrap(node) + " is unavailable.\n"
17 | }
18 | }
19 | EA += ""
20 | return(EA)
21 | }
22 |
--------------------------------------------------------------------------------
/faculty.sh.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | touch /var/.faculty
4 |
--------------------------------------------------------------------------------
/keychain-piv.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | fvstatus=$(fdesetup status)
4 |
5 | if [[ "$fvstatus" == "FileVault is On." ]]; then
6 | echo "FV ON"
7 | else
8 | echo "FV OFF"
9 | /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "Filevault Off" -description "FileVault is NOT enabled. No synchronization for smartcard is required." -button1 "Ok" -defaultButton 1 -icon /System/Library/CoreServices/Problem\ Reporter.app/Contents/Resources/ProblemReporter.icns
10 | exit 0
11 | fi
12 |
13 | GUIUSER="$(/usr/sbin/scutil <<< "show State:/Users/ConsoleUser" | awk -F': ' '/[[:space:]]+Name[[:space:]]:/ { if ( $2 != "loginwindow" ) { print $2 }}' )"
14 | echo $GUIUSER
15 | GUIUID=$(id -u $GUIUSER)
16 | echo $GUIUID
17 | hash=$(launchctl asuser $GUIUID sc_auth identities | awk '/ PIV /{print $1}')
18 | echo $hash
19 | if [ -z $hash ]; then
20 | echo "No PIV detected"
21 | /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "No PIV Detected" -description "No smartcard detected. Please try again.
22 |
23 | If problems continue, try these 2 steps.
24 | 1. Take the card out and re-insert
25 | 2. Unplug the reader and plug back in
26 | Then try again." -button1 "Ok" -defaultButton 1 -icon /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericNetworkIcon.icns
27 |
28 | exit 1
29 | fi
30 | sc_auth filevault -o disable -u $GUIUSER
31 | echo $?
32 | sudo -u $GUIUSER launchctl asuser $GUIUID sc_auth filevault -o enable -u $GUIUSER -h $hash
33 | echo $?
34 |
35 | fvstatus="$(sc_auth filevault -o status -u $GUIUSER)"
36 |
37 | if [[ "$fvstatus" =~ "not present" ]]; then
38 | echo "FAIL"
39 | if [[ "$(arch)" == "arm64" ]]; then
40 | /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "Failure" -description "Filevault and the Keychain failed to update." -button1 "Ok" -defaultButton 1 -icon /System/Library/CoreServices/Problem\ Reporter.app/Contents/Resources/ProblemReporter.icns
41 |
42 | else
43 | /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "Failure" -description "The Keychain failed to update. " -button1 "Ok" -defaultButton 1 -icon /System/Library/CoreServices/Problem\ Reporter.app/Contents/Resources/ProblemReporter.icns
44 | fi
45 | else
46 | /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "Success" -description 'Everything has updated successfully!' -button1 "Ok" -defaultButton 1 -icon '/System/Applications/Utilities/Keychain Access.app/Contents/Resources/AppIcon.icns'
47 |
48 | echo "SUCCESS"
49 | fi
50 | diskutil apfs updatePreboot /
51 | domain=$(launchctl asuser $GUIUID app-sso -l | awk -F '|' '{print $2}' | xargs)
52 | launchctl asuser $GUIUID app-sso -d $domain
53 | killall AppSSOAgent
54 |
--------------------------------------------------------------------------------
/office365-install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | CurrentOfficeRelease=$(curl -s https://macadmins.software | grep "Office 365 Suite Install" | awk -F "a href" '{ print $1 }' | awk -F ">" '{print $10}' | awk -F " " '{print $1}')
4 | CurrentOfficeInstalled=$(defaults read /Applications/Microsoft\ Word.app/Contents/Info.plist CFBundleVersion)
5 |
6 | if [ "$CurrentOfficeRelease" = "$CurrentOfficeInstalled" ]; then
7 | /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "Microsoft Office 2016" -description "You currently have the most recent version of Microsoft Office installed" -button1 "Ok" -defaultButton 1
8 | exit 0
9 | else
10 | mkdir /tmp/downloads
11 | cd /tmp/downloads
12 |
13 | OfficeURL=$(curl -s https://macadmins.software | grep "Office 365 Suite Install" | awk -F "a href" '{ print $2 }' | awk -F "'" '{ print $2 }')
14 | curl -s -o office.pkg -L $OfficeURL
15 | installer -target / -pkg "/tmp/downloads/office.pkg"
16 | rm office.pkg
17 | rm -rf /tmp/downloads
18 | exit 0
19 | fi
20 |
--------------------------------------------------------------------------------
/openCP.sh.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | open /Applications/CrashPlan
4 |
--------------------------------------------------------------------------------
/os-upgrade-notification-disable.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Disable macOS Upgrade notifications
4 |
5 | # Step 1: prevent the update which brings the notification down
6 | softwareupdate --ignore macOSInstallerNotification_GM
7 |
8 | /usr/bin/defaults write /Library/Preferences/com.apple.noticeboard.plist LastNoticeboardCatalogCheck "$(date -u "+%F %T %z")"
9 | /usr/bin/defaults write /Library/Preferences/com.apple.noticeboard.plist "com.apple.noticeboard.notification.mojave.2.0" -dict dismissalCount 4 lastDismissedDate "$(date -u "+%F %T %z")"
10 | /usr/bin/defaults write /Library/Preferences/com.apple.noticeboard.plist identifiers -array "com.apple.noticeboard.notification.mojave.2.0"
11 |
12 | # Step 2: delete the file if it's already on the computer
13 | if [[ -d /Library/Bundles/OSXNotification.bundle ]]; then
14 |
15 | rm -rf /Library/Bundles/OSXNotification.bundle
16 | else
17 | echo "OSXNotification.bundle not found."
18 | fi
19 |
--------------------------------------------------------------------------------
/power-user.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | spctl --master-disable
4 |
5 | #system preferences
6 | security authorizationdb write system.preferences allow
7 | security authorizationdb write system.preferences.network allow
8 | security authorizationdb write system.preferences.accessibility allow
9 | security authorizationdb write system.preferences.energysaver allow
10 | security authorizationdb write system.preferences.printing allow
11 | security authorizationdb write system.preferences.datetime allow
12 | security authorizationdb write system.preferences.timemachine allow
13 | security authorizationdb write system.preferences.network allow
14 | security authorizationdb write system.preferences.security allow
15 | security authorizationdb write system.services.systemconfiguration.network allow
16 |
17 |
18 | #Printing
19 | security authorizationdb write system.preferences.printing allow
20 | security authorizationdb write system.printingmanager allow
21 | security authorizationdb write system.print.admin allow
22 | security authorizationdb write system.print.operator allow
23 |
24 |
25 | #potential force restart and shutdown if other users logged in
26 | security authorizationdb write system.restart allow
27 | security authorizationdb write system.shutdown allow
28 |
29 | #App store
30 | security authorizationdb write system.install.app-store-software allow
31 |
32 | #DVD Player
33 | security authorizationdb write system.device.dvd.setregion allow
34 | security authorizationdb write system.device.dvd.setregion.chage allow
35 | security authorizationdb write system.device.dvd.setregion.initial allow
36 | security authorizationdb write system.device.dvd.setregion.change.comment allow
37 | security authorizationdb write system.device.dvd.setregion.change.change allow
38 | security authorizationdb write system.device.dvd.setregion.initial.class allow
39 | security authorizationdb write system.device.dvd.setregion.change.class allow
40 | security authorizationdb write system.device.dvd.setregion.change.comment allow
41 | security authorizationdb write system.device.dvd.setregion.change.group allow
42 | security authorizationdb write system.device.dvd.setregion.change.group allow
43 | security authorizationdb write system.device.dvd.setregion.change.shared allow
44 |
45 | #Groups needed to be in for things to unlock
46 | USERNAME=`who |grep console| awk '{print $1}'`
47 |
48 | dseditgroup -o edit -a $USERNAME -T group _appstore
49 | dseditgroup -o edit -a $USERNAME -T group lpadmin
50 |
51 | /usr/libexec/airportd prefs RequireAdminNetworkChange=NO RequireAdminIBSS=NO
52 |
53 | ## Unload locationd
54 | launchctl unload /System/Library/LaunchDaemons/com.apple.locationd.plist
55 |
56 | ## Write enabled value to locationd plist
57 | defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd LocationServicesEnabled -int 1
58 |
59 | ## Fix Permissions for the locationd folder
60 | chown -R _locationd:_locationd /var/db/locationd
61 |
62 | ## Reload locationd
63 | launchctl load /System/Library/LaunchDaemons/com.apple.locationd.plist
64 |
65 | exit 0
66 |
--------------------------------------------------------------------------------
/re-enroll.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if pgrep jamfAgent >>/dev/null; then
4 | #jamf binary is running, do nothing
5 | exit 0
6 | else
7 | echo "no jamf running" >> /Library/Logs/jamfalive.log
8 |
9 | if [ -f /usr/local/jamf/bin/jamf ]; then
10 | echo "jamf binary still there, restarting it" >> /Library/Logs/jamfalive.log
11 | /usr/local/jamf/bin/jamf manage 2&>/dev/null
12 | /usr/local/jamf/bin/jamf recon 2&>/dev/null
13 | /usr/local/jamf/bin/jamf policy 2&>/dev/null
14 | exit 0
15 | else
16 | echo "jamf binary removed!" >> /Library/Logs/jamfalive.log
17 | log show --style syslog --predicate 'process == "sudo"' | grep COMMAND >> /var/hiddenjamf/sudoLog.log
18 | until $(curl -ks https://JAMFPROSERVER/bin/jamf -o /tmp/jamf); do
19 | sleep 2
20 | done
21 | if [ ! -d /usr/local/jamf/bin ]; then
22 | mkdir -p /usr/local/jamf/bin
23 | fi
24 |
25 | mv /tmp/jamf /usr/local/jamf/bin
26 | chmod +x /usr/local/jamf/bin/jamf
27 | ln -s /usr/local/jamf/bin/jamf /usr/local/bin
28 | /usr/local/jamf/bin/jamf createConf -k -url "https://JAMFPROSERVER/"
29 | jamf enroll -invitation 12344567890987654431 2&>/dev/null
30 |
31 | fi
32 | declare -i jamfCount
33 | jamfCount="$(cat /var/hiddenjamf/count.txt)"
34 | if [[ jamfCount -eq 0 ]]; then
35 | jamfCount=1
36 | else
37 | jamfCount=jamfCount+1
38 | fi
39 | printf "$jamfCount" > /var/hiddenjamf/count.txt
40 |
41 | for i in $(dscl . list /Users UserShell | grep -v "/usr/bin/false" | grep -v "_" | awk '{print $1}'); do
42 | homeDirectory=$(dscl "/Local/Default" read "/Users/${i}" NFSHomeDirectory | awk '{ print $2 }')
43 | bashHistoryPath="${homeDirectory}/.bash_history"
44 | if [ -f $bashHistoryPath ]; then
45 | cp "$bashHistoryPath" "/var/hiddenjamf/${i}_bashHistory.txt"
46 |
47 | if cat "/var/hiddenjamf/${i}_bashHistory.txt" | grep "removeFramework"; then
48 | echo "$i removed Framework" >> /Library/Logs/jamfalive.log
49 | else
50 | echo "$i bash history stored" >> /Library/Logs/jamfalive.log
51 | fi
52 | else
53 | echo "no bash history for $i" >> /Library/Logs/jamfalive.log
54 | fi
55 | done
56 | fi
57 |
--------------------------------------------------------------------------------
/setname-joinad.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #reads name
3 | LOGPATH="/var/log/jamf.log"
4 | NAME=`grep "Set Computer Name to" $LOGPATH | tail -1 | sed -e 's/.*Name\ to\ //'`
5 |
6 | #Sets computer name
7 | /usr/local/bin/jamf setComputerName -name "$NAME"
8 |
--------------------------------------------------------------------------------
/setname.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #reads name
3 | LOGPATH="/var/log/jamf.log"
4 | NAME=`grep "Set Computer Name to" $LOGPATH | tail -1 | sed -e 's/.*Name\ to\ //'`
5 |
6 | #Sets computer name
7 | /usr/local/bin/jamf setComputerName -target / -name "$NAME"
8 |
9 |
--------------------------------------------------------------------------------
/silverlight fix.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | killall "Google Chrome"
4 | killall "Safari"
5 | killall "firefox"
6 |
7 | rm -rf "/Library/Application Support/Microsoft/PlayReady"
8 |
--------------------------------------------------------------------------------
/staff mark.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | touch /var/.staff
4 |
--------------------------------------------------------------------------------
/student mark.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | touch /var/.student
4 |
--------------------------------------------------------------------------------