├── ADPassMonPrefs └── adpassmonprefs.sh ├── README.md ├── addAndTrustCert └── addAndTrustCert.sh ├── addNetworkPrinter └── addNetworkPrinter.sh ├── autoUpdateChrome └── auto_install_chrome.sh ├── autoUpdateFirefox └── autoUpdateFirefox.sh ├── autoUpdateJava7 └── autoUpdateJava7.sh ├── autoUpdateJava8 ├── install_latest_oracle_java_8.sh └── readme.MD ├── autoUpdateVLC ├── README.md └── vlcAutoUpdate.sh ├── clearAllOSXProfiles └── clearAllOSXProfiles.sh ├── disableChromePrintDialog └── disableChromePrintDialog.sh ├── disableFindMyMac └── disableFMM.sh ├── disableGuestAccount └── disableGuest.sh ├── disableiTunesSharing └── disableiTunesSharing.sh ├── enableLocationServices └── enableLocationServices.sh ├── enableOSXAutomaticUpdates └── enableOSXAutomaticUpdates.sh ├── hideUsersUnderUID500 └── hideUsersUnderUID500.sh ├── logcatcher └── logcatcher.sh ├── logout └── logout.sh ├── microsoftOfficeUpdateSetting └── disableOfficeUpdates.sh ├── namechanger ├── namerenamebeta.sh ├── namerenamerv1.sh └── namerenamerv2.sh ├── namechecker └── namecheckerv1.sh ├── osxSMBfix └── osxSMBFix.sh ├── removeFileMaker12 └── removeFileMaker12.sh ├── removeFileMaker13 └── removeFileMaker13.sh ├── removeFileMaker8to12 └── removeFileMaker8-12.sh ├── resetLoginKeychain └── keychainreset.sh ├── resetLyncKeychain └── deleteLynckeychain.sh ├── softwareupdate └── softwareupdate.sh ├── toggleNotificationCenter └── toggleNotificationCenter.sh ├── toggleSSH └── toggleSSH.sh ├── toggleShowHiddenFiles └── toggleShowHiddenFiles.sh └── vpnMenuSetup └── vpnSetup.sh /ADPassMonPrefs/adpassmonprefs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Lock the preferences 3 | defaults write /Library/Preferences/org.pmbuko.ADPassMon prefsLocked true 4 | # Check keychain on startup 5 | defaults write /Library/Preferences/org.pmbuko.ADPassMon enableKeychainLockCheck -bool true 6 | # Disable notifications 7 | defaults write /Library/Preferences/org.pmbuko.ADPassMon enableNotifications -bool false 8 | # Warning settings 9 | # defaults write /Library/Preferences/org.pmbuko.ADPassMon warningDays -int 5 10 | defaults write /Library/Preferences/org.pmbuko.ADPassMon expireAge -int 90 11 | # Password change settings 12 | defaults write /Library/Preferences/org.pmbuko.ADPassMon selectedMethod -int 2 13 | defaults write /Library/Preferences/org.pmbuko.ADPassMon selectedBehaviour -int 1 14 | defaults write /Library/Preferences/org.pmbuko.ADPassMon keychainPolicy "As a reminder, please choose a password that is at least 8 characters with one number, letter, and special character that is not a previous password." 15 | # Password check interval (six hours so at least once a day) 16 | defaults write org.pmbuko.ADPassMon passwordCheckInterval -int "6" 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 74bit_scripts 2 | Contains scripts that are in-use or were used by the team at 74bit, Inc. 3 | -------------------------------------------------------------------------------- /addAndTrustCert/addAndTrustCert.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Adds a security certificate to the system keychain and manually sets as trusted 3 | # Assumes certificate has already been placed on machine 4 | 5 | TARGET_KEYCHAIN="/Library/Keychains/System.keychain" 6 | CERT_PATH="/private/tmp/radius.com.cer" 7 | 8 | security add-trusted-cert -d -k "$TARGET_KEYCHAIN" "$CERT_PATH" -------------------------------------------------------------------------------- /addNetworkPrinter/addNetworkPrinter.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Printer Display Name 4 | printerName="Canon_C5235" 5 | 6 | # Path to Printer Driver 7 | # Example 8 | # printerDriver="/Library/Printers/PPDs/Contents/Resources/CNMCIRAC5235S2.ppd.gz" 9 | printerDriver="/Library/Printers/PPDs/your-driver-here" 10 | 11 | # Contains protocol and IP/hostname 12 | # Example 13 | # printerAddress="lpd://192.168.1.2" 14 | printerAddress="lpd://0.0.0.0" 15 | 16 | if [ ! -f "$printerDriver" ]; then 17 | printf "Driver not found!" 18 | else 19 | lpadmin -p $printerName -E -v $printerAddress -P "$printerDriver" 20 | fi 21 | exit 0 22 | -------------------------------------------------------------------------------- /autoUpdateChrome/auto_install_chrome.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Running artisinal bash install scripts is generally not recommended. 3 | # your funeral 4 | 5 | DOWNLOAD_URL="https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg" 6 | DMG_PATH="/tmp/Google Chrome.dmg" 7 | DMG_VOLUME_PATH="/Volumes/Google Chrome/" 8 | APP_NAME="Google Chrome.app" 9 | APP_PATH="/Applications/$APP_NAME" 10 | APP_PROCESS_NAME="Google Chrome" 11 | APP_INFO_PLIST="Contents/Info.plist" 12 | APP_VERSION_KEY="CFBundleShortVersionString" 13 | 14 | if pgrep "$APP_PROCESS_NAME" &>/dev/null; then 15 | printf "Error - %s is currently running!" "$APP_PROCESS_NAME" 16 | else 17 | if [ -d "$APP_PATH" ]; then 18 | rm -rf "$APP_PATH" 19 | fi 20 | curl --retry 3 -L "$DOWNLOAD_URL" -o "$DMG_PATH" 21 | hdiutil attach -nobrowse -quiet "$DMG_PATH" 22 | minimumSystemVersion=$(defaults read "$DMG_VOLUME_PATH/$APP_NAME/$APP_INFO_PLIST" LSMinimumSystemVersion | awk -F. '{print $2}') 23 | osVersion=$(sw_vers -productVersion | awk -F. '{print $2}') 24 | if [[ $osVersion -le $minimumSystemVersion ]]; then 25 | printf "OS is below minimum version." 26 | else 27 | version=$(defaults read "$DMG_VOLUME_PATH/$APP_NAME/$APP_INFO_PLIST" "$APP_VERSION_KEY") 28 | printf "Installing $APP_PROCESS_NAME version %s" "$version" 29 | ditto -rsrc "$DMG_VOLUME_PATH/$APP_NAME" "$APP_PATH" 30 | fi 31 | hdiutil detach -quiet "$DMG_VOLUME_PATH" 32 | rm "$DMG_PATH" 33 | fi 34 | -------------------------------------------------------------------------------- /autoUpdateFirefox/autoUpdateFirefox.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Firefox Auto-Install/Update 3 | 4 | currentFirefoxVersion=`curl -silent http://www.mozilla.org/en-US/firefox/all/ | grep -m1 -o 'firefox-[0-9]*\.[0-9]\.[0-9]'` 5 | currentFirefoxVersion=${currentFirefoxVersion:8} 6 | 7 | if [ ! $currentFirefoxVersion ]; then 8 | currentFirefoxVersion=`curl -silent http://www.mozilla.org/en-US/firefox/all/ | grep -m1 -o 'firefox-[0-9]*\.[0-9]'` 9 | currentFirefoxVersion=${currentFirefoxVersion:8} 10 | fi 11 | if [ ! $currentFirefoxVersion ]; then 12 | echo "Couldn't find new version number! Exiting.." 13 | exit 1 14 | fi 15 | 16 | localFirefoxVersion=`defaults read /Applications/Firefox.app/Contents/Info.plist CFBundleShortVersionString` 17 | echo "Installing/Updating Firefox to version $currentFirefoxVersion" 18 | 19 | if [[ "$currentFirefoxVersion" == "$localFirefoxVersion" ]]; then 20 | echo "Firefox is already up-to-date! Exiting..." 21 | exit 2 22 | else 23 | if [[ -d /Applications/Firefox.app/ ]]; then 24 | echo 'Removing old version...' 25 | sudo rm -rf /Applications/Firefox.app 26 | fi 27 | curl -GLo /tmp/firefox.dmg "https://download.mozilla.org/?product=firefox-$currentFirefoxVersion-SSL&os=osx&lang=en-US" 28 | hdiutil mount -quiet -nobrowse /tmp/firefox.dmg 29 | if [ $? != 0 ]; then 30 | echo "Unable to mount installer!" 31 | exit 3 32 | fi 33 | ditto -rsrc /Volumes/Firefox/Firefox.app /Applications/Firefox.app 34 | hdiutil unmount /Volumes/Firefox 35 | rm /tmp/firefox.dmg 36 | echo "Firefox updated! Exiting..." 37 | fi 38 | exit 0 -------------------------------------------------------------------------------- /autoUpdateJava7/autoUpdateJava7.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Upgrades Java 7 for Mac OS X. 3 | # Created by Owen Pragel on Feburary 4th, 2014. 4 | # Last modified: 5/30/14 5 | clear 6 | echo "Java 7 auto-updater for OS X by Owen Pragel" 7 | echo "This script must be run with root privileges." 8 | echo "Tested on OS X 10.9.3 with Java 7 update 60." 9 | echo "" 10 | if [ -e /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java ]; then 11 | javaVersionStart="$(/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version 2>&1 | grep "java" | awk '{ print substr($3, 2, length($3)-2); }' | tail -c 3)" 12 | fi 13 | 14 | versionPage="https://www.java.com/en/download/faq/release_changes.xml" 15 | currentVersion=$(curl -s $versionPage | grep -o 7u.. | head -1) 16 | currentVersionUpdateN=$(echo $currentVersion | tail -c 3) 17 | if [[ "$currentVersionUpdateN" -gt "$javaVersionStart" ]]; then 18 | echo "Upgrading from Java version $javaVersionStart to $currentVersionUpdateN" 19 | curl -L "http://javadl.sun.com/webapps/download/AutoDL?BundleId=90217" -o "/tmp/jre-$currentVersion-macosx-x64.dmg" 20 | volumePath=$(hdiutil attach "/tmp/jre-$currentVersion-macosx-x64.dmg" | grep -o -E -m1 '/Volumes/Java.*') 21 | pkgVersion=$(ls "$volumePath" | grep 'Java') 22 | installer -pkg "$volumePath"/"$pkgVersion" -target / 23 | hdiutil detach "$volumePath" 2>&1 1>/dev/null 24 | rm -f "/tmp/jre-$currentVersion-macosx-x64.dmg" 25 | else 26 | echo "Java 7 is already up-to-date (version $javaVersionStart)! Exiting..." 27 | exit 1 28 | fi 29 | exit 0 30 | -------------------------------------------------------------------------------- /autoUpdateJava8/install_latest_oracle_java_8.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script downloads and installs the latest Oracle Java 8 for compatible Macs 4 | 5 | # Determine OS version 6 | osvers=$(sw_vers -productVersion | awk -F. '{print $2}') 7 | 8 | # Specify the "OracleUpdateXML" variable by adding the "SUFeedURL" value included in the 9 | # /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Info.plist file. 10 | # 11 | # Note: The "OracleUpdateXML" variable is currently specified in the script as that for 12 | # Java 8 Update 20, but the XML address embedded with Java 8 Update 20 is not special in 13 | # this regard. I have verified that using the address for Java 8 Update 5 will also work 14 | # to pull the address of the latest Oracle Java 8 installer disk image. To get the "SUFeedURL" 15 | # value embedded with your currently installed version of Java 8 on Mac OS X, please run 16 | # the following command in Terminal: 17 | # 18 | # defaults read "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Info" SUFeedURL 19 | # 20 | # As of Java 8 Update 20, that produces the following return: 21 | # 22 | # https://javadl-esd-secure.oracle.com/update/mac/au-1.8.0_20.xml 23 | # 24 | 25 | OracleUpdateXML="https://javadl-esd-secure.oracle.com/update/mac/au-1.8.0_20.xml" 26 | 27 | # Use the XML address defined in the OracleUpdateXML variable to query Oracle via curl 28 | # for the complete address of the latest Oracle Java 8 installer disk image. 29 | 30 | fileURL=`/usr/bin/curl --silent $OracleUpdateXML | awk -F \" /enclosure/'{print $(NF-1)}'` 31 | 32 | # Specify name of downloaded disk image 33 | 34 | java_eight_dmg="/tmp/java_eight.dmg" 35 | 36 | if [[ ${osvers} -lt 7 ]]; then 37 | echo "Oracle Java 8 is not available for Mac OS X 10.6.8 or earlier." 38 | fi 39 | 40 | if [[ ${osvers} -ge 7 ]]; then 41 | 42 | # Download the latest Oracle Java 8 software disk image 43 | # The curl -L option is needed because there is a redirect 44 | # that the requested page has moved to a different location. 45 | 46 | /usr/bin/curl --retry 3 -Lo "$java_eight_dmg" "$fileURL" 47 | 48 | # Specify a /tmp/java_eight.XXXX mountpoint for the disk image 49 | 50 | TMPMOUNT=`/usr/bin/mktemp -d /tmp/java_eight.XXXX` 51 | 52 | # Mount the latest Oracle Java 8 disk image to /tmp/java_eight.XXXX mountpoint 53 | 54 | hdiutil attach "$java_eight_dmg" -mountpoint "$TMPMOUNT" -nobrowse -noverify -noautoopen 55 | 56 | # Install Oracle Java 8 from the installer package. This installer may 57 | # be stored inside an install application on the disk image, or there 58 | # may be an installer package available at the root of the mounted disk 59 | # image. 60 | 61 | if [[ -e "$(/usr/bin/find $TMPMOUNT -maxdepth 1 \( -iname \*\.app \))/Contents/Resources/JavaAppletPlugin.pkg" ]]; then 62 | /usr/sbin/installer -dumplog -verbose -pkg "$(/usr/bin/find $TMPMOUNT -maxdepth 1 \( -iname \*\.app \))/Contents/Resources/JavaAppletPlugin.pkg" -target "/" 63 | fi 64 | 65 | if [[ -e "$(/usr/bin/find $TMPMOUNT -maxdepth 1 \( -iname \*\.pkg -o -iname \*\.mpkg \))" ]]; then 66 | /usr/sbin/installer -dumplog -verbose -pkg "$(/usr/bin/find $TMPMOUNT -maxdepth 1 \( -iname \*\.pkg -o -iname \*\.mpkg \))" -target "/" 67 | fi 68 | 69 | # Clean-up 70 | 71 | # Unmount the Oracle Java 8 disk image from /tmp/java_eight.XXXX 72 | 73 | /usr/bin/hdiutil detach -force "$TMPMOUNT" 74 | 75 | # Remove the /tmp/java_eight.XXXX mountpoint 76 | 77 | /bin/rm -rf "$TMPMOUNT" 78 | 79 | # Remove the downloaded disk image 80 | 81 | /bin/rm -rf "$java_eight_dmg" 82 | fi 83 | 84 | exit 0 85 | -------------------------------------------------------------------------------- /autoUpdateJava8/readme.MD: -------------------------------------------------------------------------------- 1 | This script will download a disk image containing the latest version of Java 8 from Oracle and install Java 8 using the installer package stored inside the downloaded disk image. 2 | 3 | How the script works: 4 | 5 | 1. Uses curl to download a disk image containing the latest Java 8 installer from Oracle's web site 6 | 7 | 2. Renames the downloaded disk image to java_eight.dmg and stores it in /tmp 8 | 9 | 3. Mounts the disk image silently in /tmp. The mounted disk image will not be visible to any logged-in user. 10 | 11 | 4. Installs the latest Java 8 using the installer package stored inside the disk image. 12 | 13 | Note: This installer may be stored inside an install application on the disk image, or there may be an installer package available at the root of the mounted disk image. 14 | 15 | 5. After installation, unmounts the disk image and removes it from the Mac in question. 16 | 17 | 18 | This script is also available as a payload-free installer package, stored as a .zip file in the payload_free_installer directory. 19 | 20 | Accompanying blog post: http://derflounder.wordpress.com/2014/08/17/automating-oracle-java-8-updates/ 21 | -------------------------------------------------------------------------------- /autoUpdateVLC/README.md: -------------------------------------------------------------------------------- 1 | VLC Auto Update Script 2 | =========== 3 | This script silently downloads the latest VLC binaries for Mac OS X 4 | and copies them to the Application directory, overwriting any files that 5 | may share the same name. It relies on a rather specific regex 6 | and that the latest VLC installer is available through the 7 | remote directory listed in the script. Last known to work 4/17/1 for VLC 8 | 2.1.4, OS X versions 10.8 and 10.9. 9 | 10 | -------------------------------------------------------------------------------- /autoUpdateVLC/vlcAutoUpdate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Downloads the last VLC version for OS X Intel64 3 | # Created by Owen Pragel on 11/8/2013. 4 | # Updated 4/3/14 5 | 6 | appName='VLC' 7 | 8 | rm -rf "/Applications/$appName.app" 9 | 10 | echo "$appName autoinstaller by 74bit\n" 11 | 12 | # Program update feed/directory 13 | echo "Loading update list..." 14 | updateFeed='http://update.videolan.org/vlc/sparkle/vlc-intel64.xml' 15 | 16 | # Regex to match latest download url 17 | urlRegex='http://get.videolan.org/vlc/[0-9]\.[0-9]\.[0-9]/macosx/vlc-[0-9]\.[0-9]\.[0-9]\.dmg' 18 | # Gets the URL of the last VLC update listed on the feed 19 | downloadURL=$(curl -# $updateFeed | grep -o $urlRegex | tail -1 ) 20 | # Isolates the current version number of VLC 21 | versionRegex='vlc-[0-9]\.[0-9]\.[0-9]' 22 | currentVersion=$(echo $downloadURL | grep -o $versionRegex ) 23 | 24 | # Temporary local download directory 25 | localDirectory='/tmp/' 26 | 27 | echo "Downloading: $downloadURL" 28 | echo "To: $localDirectory$currentVersion" 29 | curl $downloadURL -L -o $localDirectory$currentVersion -w '%{url_effective}' 30 | 31 | volumePath=$(hdiutil attach $localDirectory$currentVersion | grep -o -E -m1 '/Volumes/vlc-.....') 32 | 33 | appPath="/$appName.app" 34 | 35 | echo "Copying $volumePath$appPath" to "/Applications$appPath" 36 | cp -Rfv "$volumePath$appPath" "/Applications$appPath" 37 | 38 | hdiutil detach $volumePath 39 | 40 | exit 0 41 | -------------------------------------------------------------------------------- /clearAllOSXProfiles/clearAllOSXProfiles.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | /usr/bin/profiles -D 3 | -------------------------------------------------------------------------------- /disableChromePrintDialog/disableChromePrintDialog.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | defaults write com.google.Chrome DisablePrintPreview -boolean true -------------------------------------------------------------------------------- /disableFindMyMac/disableFMM.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | nvram -d fmm-computer-name 3 | nvram -d fmm-mobileme-token-FMM 4 | -------------------------------------------------------------------------------- /disableGuestAccount/disableGuest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Disables guest accounts 3 | defaults write /Library/Preferences/com.apple.loginwindow.plist GuestEnabled -bool NO -------------------------------------------------------------------------------- /disableiTunesSharing/disableiTunesSharing.sh: -------------------------------------------------------------------------------- 1 | # Disables iTunes library sharing 2 | defaults write com.apple.iTunes disableSharedMusic -bool YES 3 | -------------------------------------------------------------------------------- /enableLocationServices/enableLocationServices.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Enables location services on machine 3 | # Created by Owen Pragel on July 23rd, 2013 4 | launchctl unload /System/Library/LaunchDaemons/com.apple.locationd.plist 5 | uuid=`/usr/sbin/system_profiler SPHardwareDataType | grep "Hardware UUID" | cut -c22-57` 6 | defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd.$uuid LocationServicesEnabled -int 1 7 | chown -R _locationd:_locationd /var/db/locationd 8 | launchctl load /System/Library/LaunchDaemons/com.apple.locationd.plist -------------------------------------------------------------------------------- /enableOSXAutomaticUpdates/enableOSXAutomaticUpdates.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | defaults write /Library/Preferences/com.apple.commerce.plist AutoUpdate -bool TRUE 3 | defaults write /Library/Preferences/com.apple.commerce.plist AutoUpdateRestartRequired -bool TRUE 4 | defaults write /Library/Preferences/com.apple.SoftwareUpdate.plist AutomaticCheckEnabled -bool TRUE 5 | defaults write /Library/Preferences/com.apple.SoftwareUpdate.plist AutomaticDownload -bool TRUE 6 | defaults write /Library/Preferences/com.apple.SoftwareUpdate.plist CriticalUpdateInstall -bool TRUE 7 | defaults write /Library/Preferences/com.apple.SoftwareUpdate.plist ConfigDataInstall -bool TRUE 8 | -------------------------------------------------------------------------------- /hideUsersUnderUID500/hideUsersUnderUID500.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | defaults write /Library/Preferences/com.apple.loginwindow Hide500Users -bool YES 3 | -------------------------------------------------------------------------------- /logcatcher/logcatcher.sh: -------------------------------------------------------------------------------- 1 | @@ -1,15 +1,20 @@ 2 | #!/bin/bash 3 | # v1.0 / Logan Fink / 74bit / 28 April 2015 4 | # v1.0.1 cleanup on aisle 5 5 | # v1.1 cleanup on aisle 6 ... changed the method for getting the user 6 | # This puts log files on the current users desktop so they can attach it to tickets 7 | #Variables 8 | currentUser=$(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");') 9 | 10 | if [[ "$currentUser" -ne "" && -d "/Users/$CURRENT_USER_NAME/Desktop" ]]; then 11 | logOutputDirectory="/Users/$currentUser/Desktop/" 12 | else 13 | logOutputDirectory="/Users/Shared/" 14 | fi 15 | 16 | dateStamp=$(date +%Y\.%m\.%d-%H%M) 17 | logZipName="$dateStamp-logs.zip" 18 | logOutputDirectory="/Users/$currentUser/Desktop/" 19 | 20 | # 21 | #if [[ "$currentUser" -ne "" && -d "/Users/$currentUser/Desktop" ]]; then 22 | # logOutputDirectory="/Users/$currentUser/Desktop/" 23 | # echo "i got the username" 24 | #else 25 | # logOutputDirectory="/Users/Shared/" 26 | # echo "i cant figure out the username" 27 | #fi 28 | 29 | zip -r "$logOutputDirectory$logZipName" /Library/Logs/DiagnosticReports/ /var/log/ -x '*.zip' '*.gz' 30 | -------------------------------------------------------------------------------- /logout/logout.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #disables sleep 3 | #systemsetup -setcomputersleep 15 4 | 5 | #http://hints.macworld.com/article.php?story=20040330161158532 6 | #https://jamfnation.jamfsoftware.com/discussion.html?id=11807 7 | #Make the directory for the flat file 8 | #I could add an if/then in here 9 | mkdir /Library/jamf/ 10 | #This gets the IDLE time for variable 11 | IDLE=$((`ioreg -c IOHIDSystem | sed -e '/HIDIdleTime/ !{ d' -e 't' -e '}' -e 's/.* = //g' -e 'q'` / 1000000000)) 12 | #Writes the variable to flatfile 13 | #Next version to delete this file at the beginning of the script so it doesn't grow over time. 14 | #I made it this way to test... there should be two lines first one is idle when the script ran 15 | #Second should be super close when the if statement starts 16 | echo $IDLE >> /Library/jamf/flatfile 17 | #This is in seconds 18 | if [ "$IDLE" -ge "3600" ] ; 19 | then 20 | echo $IDLE >> /Library/jamf/flatfile 21 | osascript -e 'tell application "System Events" to log out' 22 | pause 90 23 | killall loginwindow 24 | fi 25 | exit 0 26 | -------------------------------------------------------------------------------- /microsoftOfficeUpdateSetting/disableOfficeUpdates.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Sets Office 2011 to only check for updates manually 3 | lastUser=`defaults read /Library/Preferences/com.apple.loginwindow lastUserName` 4 | defaults write "/Users/"$lastUser"/Library/Preferences/com.microsoft.autoupdate2" HowToCheck Manual 5 | chown $lastUser "/Users/"$lastUser"/Library/Preferences/com.microsoft.autoupdate2.plist" -------------------------------------------------------------------------------- /namechanger/namerenamebeta.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Network Name Updater thingy 3 | # Author : Matthew Bodaly 4 | # Updated : 17 October 2012 5 | 6 | # Disable Bonjour 7 | launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist 8 | # Make a folder to store resource files 9 | mkdir /Library/Application\ Support/caspersupport 10 | # Ask for the barcode of the computer 11 | echo -n "Enter the name of this computer. Check the barcode" 12 | # Set entry as a variable 13 | read -e BELUS 14 | # Write the variable to a file in the resource folder 15 | echo $BELUS > /Library/Application\ Support/caspersupport/assettag 16 | # Backup the file that will be changed 17 | cp /etc/hostconfig /Library/Application\ Support/caspersupport/hostconfig.bak 18 | # Change the HostName to the variable 19 | scutil --set HostName $BELUS 20 | # Change the ComputerName to the variable 21 | scutil --set ComputerName $BELUS 22 | # Write the variable to the end of /etc/hostconfig. This uses the FQDN. If you have a FQDN... you should change this. 23 | echo HOSTNAME=$BELUS.apptio.lan >> /etc/hostconfig 24 | # change the Bonjour name 25 | systemsetup -setlocalsubnetname $BELUS 26 | #reenable Bonjour 27 | launchctl load -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist 28 | 29 | -------------------------------------------------------------------------------- /namechanger/namerenamerv1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # this takes the name that the computer has in JAMF and then renames 3 | # all computer variables to that name AND adds a flat text file at 4 | # /Library/Application\ Support/assettag 5 | # Make a folder to store resource files. Commenting this out since this line isn't needed 6 | # when the script is deployed via Casper. Uncomment to enable. 7 | mkdir /Library/Application\ Support/caspersupport 8 | # Get for the name of the computer from Casper and write it to a file 9 | jamf -getComputerName | cut -c 16-24 > /Library/Application\ Support/caspersupport/assettag 10 | # Set entry as a variable 11 | BELUS=$(more /Library/Application\ Support/caspersupport/assettag) 12 | # Backup the file that will be changed 13 | cp /etc/hostconfig /Library/Application\ Support/caspersupport/hostconfig.bak 14 | # Change the HostName to the variable 15 | scutil --set HostName $BELUS 16 | # Change the ComputerName to the variable 17 | scutil --set ComputerName $BELUS 18 | # Write the variable to the end of /etc/hostconfig. This uses the FQDN. If you have a FQDN... you should change this. 19 | echo HOSTNAME=$BELUS.apptio.lan >> /etc/hostconfig 20 | # change the Bonjour name 21 | systemsetup -setlocalsubnetname $BELUS 22 | -------------------------------------------------------------------------------- /namechanger/namerenamerv2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # this ninja takes the name that the computer has in JAMF and then renames 3 | # all computer variables to that name AND adds a flat text file at 4 | # /Library/Application\ Support/assettag 5 | # Make a folder to store resource files. Commenting this out since this line isn't needed 6 | # when the script is deployed via Casper. Uncomment to enable. 7 | # mkdir /Library/Application\ Support/caspersupport 8 | # force an unbind. 9 | dsconfigad -force -remove -u user -p babytownfrolics 10 | #ask the user what their asset tag is 11 | CD="/usr/local/bin/cocoaDialog.app/Contents/MacOS/CocoaDialog" 12 | rv=($($CD standard-inputbox --title "Asset Tag" --no-newline --informative-text "What is the barcode on this computer?")) 13 | BELUS=${rv[1]} 14 | if [ "$rv" == "1" ]; then 15 | echo "User said OK" 16 | elif [ "$rv" == "2" ]; then 17 | echo "Canceling" 18 | exit 19 | fi 20 | # Get for the name of the computer from Casper and write it to a file 21 | # jamf -getComputerName | cut -c 16-24 > /Library/Application\ Support/caspersupport/assettag 22 | # Set entry as a variable 23 | echo $BELUS > /Library/Application\ Support/caspersupport/assettag2 24 | # BELUS=$(more /Library/Application\ Support/caspersupport/assettag) 25 | # Backup the file that will be changed 26 | cp /etc/hostconfig /Library/Application\ Support/caspersupport/hostconfig.bak 27 | # Change the HostName to the variable 28 | scutil --set HostName $BELUS 29 | # Change the ComputerName to the variable 30 | scutil --set ComputerName $BELUS 31 | # Write the variable to the end of /etc/hostconfig. This uses the FQDN. If you have a FQDN... you should change this. 32 | echo HOSTNAME=$BELUS.XXX.lan >> /etc/hostconfig 33 | # change the Bonjour name 34 | systemsetup -setlocalsubnetname $BELUS 35 | sudo jamf recon 36 | #rebind to active directory 37 | -------------------------------------------------------------------------------- /namechecker/namecheckerv1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This checks to make sure all of the system names are the same as the assettag file. 3 | NAME=$(more /Library/Application\ Support/caspersupport/assettag) 4 | LOCAL=$(scutil --get ComputerName) 5 | if [ "$NAME" != "$LOCAL" ]; 6 | then 7 | # Change the HostName to the variable 8 | scutil --set HostName $NAME; 9 | # Change the ComputerName to the variable 10 | scutil --set ComputerName $NAME; 11 | # change the Bonjour name 12 | systemsetup -setlocalsubnetname $NAME 13 | fi 14 | -------------------------------------------------------------------------------- /osxSMBfix/osxSMBFix.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Forces SMB1 and disables named streams 3 | NSMB_GLOBAL_CONFIGURATION="/etc/nsmb.conf" 4 | NSMB_CONFIGURATION="/Library/Preferences/nsmb.conf" 5 | if [ -f "$NSMB_GLOBAL_CONFIGURATION" ]; then 6 | rm "$NSMB_GLOBAL_CONFIGURATION" 7 | fi 8 | 9 | if [ -f "$NSMB_CONFIGURATION" ]; then 10 | rm "$NSMB_CONFIGURATION" 11 | fi 12 | 13 | for USER_HOME in /Users/* 14 | do 15 | USER_UID=$(basename "${USER_HOME}") 16 | if [ ! "${USER_UID}" = "Shared" ]; then 17 | if [ -f "/Users/$USER_UID$NSMB_CONFIGURATION" ]; then 18 | rm "/Users/$USER_UID$NSMB_CONFIGURATION" 19 | fi 20 | fi 21 | done 22 | 23 | printf "[default]\nsmb_neg=smb1_only\nstreams=no" > /etc/nsmb.conf 24 | -------------------------------------------------------------------------------- /removeFileMaker12/removeFileMaker12.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Removes FileMaker Pro and FileMaker Pro Advanced 12 3 | # Created by Owen Pragel on 10/31/13 Last Modified 11/01/13 4 | 5 | clear 6 | 7 | lastUser=`defaults read /Library/Preferences/com.apple.loginwindow lastUserName` 8 | removePrefs=$1 9 | 10 | echo "FileMaker 12 uninstaller by 74Bit" 11 | echo -e "Created 11/19/13 Last Modified 11/19/13\n" 12 | 13 | fmPaths=( "/Applications/FileMaker Pro 12/" "/Applications/FileMaker Pro 12 Advanced/" ) 14 | 15 | echo "Removing application folders..." 16 | for i in "${fmPaths[@]}" 17 | do 18 | if [ -d "$i" ]; then 19 | echo -e "Deleting: $i" 20 | rm -rf "$i" 21 | else 22 | echo "Not found: $i" 23 | fi 24 | done 25 | 26 | if [ "$removePrefs" == "removePrefs" ]; then 27 | echo -e "\nRemoving FileMaker Preferences" 28 | # Note, will not delete FM 11 or 12 preferences. If 11 is installed and 12 is also on the machine, the 11 files are renamed. Refer to FM website. 29 | fmPrefs=( "/users/"$lastUser"/Library/Preferences/FileMaker Preferences/" ) 30 | for i in "${fmPrefs[@]}" 31 | do 32 | if [ -d "$i" ]; then 33 | echo "Removing: $i" 34 | rm -rf "$i" 35 | else 36 | echo -n "Not found: ~/" 37 | echo "$i" | cut -c16- 38 | fi 39 | done 40 | fi 41 | 42 | echo -e "\nUninstall Completed\n" 43 | 44 | exit 0 45 | -------------------------------------------------------------------------------- /removeFileMaker13/removeFileMaker13.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Removes FileMaker Pro and FileMaker Pro Advanced 13 3 | # Created by Owen Pragel on 04/20/14 Last Modified 04/20/14 4 | 5 | clear 6 | 7 | lastUser=`defaults read /Library/Preferences/com.apple.loginwindow lastUserName` 8 | removePrefs=$1 9 | 10 | echo "FileMaker 13 uninstaller by 74Bit" 11 | echo -e "Created 04/20/14 Last Modified 04/20/14\n" 12 | 13 | fmPaths=( "/Applications/FileMaker Pro 13/" "/Applications/FileMaker Pro 13 Advanced/" ) 14 | 15 | echo "Removing application folders..." 16 | for i in "${fmPaths[@]}" 17 | do 18 | if [ -d "$i" ]; then 19 | echo -e "Deleting: $i" 20 | rm -rf "$i" 21 | else 22 | echo "Not found: $i" 23 | fi 24 | done 25 | 26 | if [ "$removePrefs" == "removePrefs" ]; then 27 | echo -e "\nRemoving FileMaker Preferences" 28 | # Note, will not delete FM 11 or 13 preferences. If 11 is installed and 13 is also on the machine, the 11 files are renamed. Refer to FM website. 29 | fmPrefs=( "/users/"$lastUser"/Library/Preferences/FileMaker Preferences/" ) 30 | for i in "${fmPrefs[@]}" 31 | do 32 | if [ -d "$i" ]; then 33 | echo "Removing: $i" 34 | rm -rf "$i" 35 | else 36 | echo -n "Not found: ~/" 37 | echo "$i" | cut -c16- 38 | fi 39 | done 40 | fi 41 | 42 | echo -e "\nUninstall Completed\n" 43 | 44 | exit 0 45 | -------------------------------------------------------------------------------- /removeFileMaker8to12/removeFileMaker8-12.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Removes FileMaker Pro and FileMaker Pro Advanced versions 8-12 3 | # If removePrefs is used as a command argument it will also remove FileMaker Preferences 4 | # Note, Remove Prefs section disabled 5 | # Created by Owen Pragel on 04/20/14 Last Modified 04/20/14 6 | 7 | clear 8 | 9 | lastUser=`defaults read /Library/Preferences/com.apple.loginwindow lastUserName` 10 | removePrefs=$1 11 | 12 | echo "FileMaker 8-12 uninstaller by 74Bit" 13 | echo -e "Created 04/20/14 Last Modified 04/20/14\n" 14 | 15 | fmPaths=( "/Applications/FileMaker Pro 8/" "/Applications/FileMaker Pro 8 Advanced/" "/Applications/FileMaker Pro 9/" "/Applications/FileMaker Pro 9 Advanced" "/Applications/FileMaker Pro 10/" "/Applications/FileMaker Pro 10 Advanced/" "/Applications/FileMaker Pro 11/" "/Applications/FileMaker Pro 11 Advanced" "/Applications/FileMaker Pro 12/" "/Applications/FileMaker Pro 12 Advanced/" ) 16 | 17 | echo "Removing application folders..." 18 | for i in "${fmPaths[@]}" 19 | do 20 | if [ -d "$i" ]; then 21 | echo -e "Deleting: $i" 22 | rm -rf "$i" 23 | else 24 | echo "Not found: $i" 25 | fi 26 | done 27 | 28 | <<'if [ "$removePrefs" == "removePrefs" ]; then 29 | echo -e "\nRemoving FileMaker Preferences" 30 | # Note, will not delete FM 11 or 12 preferences. If 11 is installed and 12 is also on the machine, the 11 files are renamed. Refer to FM website. 31 | fmPrefs=( "/users/"$lastUser"/Library/Preferences/FileMaker Preferences/" ) 32 | for i in "${fmPrefs[@]}" 33 | do 34 | if [ -d "$i" ]; then 35 | echo "Removing: $i" 36 | rm -rf "$i" 37 | else 38 | echo -n "Not found: ~/" 39 | echo "$i" | cut -c16- 40 | fi 41 | done 42 | fi' 43 | 44 | echo -e "\nUninstall Completed\n" 45 | 46 | exit 0 47 | -------------------------------------------------------------------------------- /resetLoginKeychain/keychainreset.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ######################################################################## 4 | # Created By: Andrina Kelly, andrina.kelly@bellmedia.ca, Ext 4995 5 | # Creation Date: July 2013 6 | # Last Modified: Matthew Bodaly Feb 2016 - changed currentUser method 7 | # Brief Description: Deletes the users login.keychain, and creates a new keychain 8 | ######################################################################## 9 | 10 | getpass() 11 | { 12 | asmsg=$(osascript -e 'tell app "System Events" 13 | Activate 14 | set foo to text returned of (display dialog "Enter the password you use to login:" default answer "" buttons {"Continue"} default button 1 with hidden answer) 15 | end tell') 16 | if [ ! "$asmsg" ]; then 17 | getpass 18 | else 19 | echo $asmsg 20 | fi 21 | } 22 | 23 | #Find out who's logged in 24 | currentUser=$(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");') 25 | echo "I know who is logged in" 26 | #Get the name of the users keychain - some messy sed and awk to set up the correct name for security to like 27 | KEYCHAIN=`su $currentUser -c "security list-keychains" | grep login | sed -e 's/\"//g' | sed -e 's/\// /g' | awk '{print $NF}'` 28 | echo "I got the keychain file" 29 | #Go delete the keychain in question... 30 | su $currentUser -c "security delete-keychain $KEYCHAIN" 31 | echo "I deleted the keychain" 32 | #Ask the user for their login password to create a new keychain 33 | PASSWORD=$(getpass) 34 | echo "I just got a password. Now I am going to hack the planet" 35 | #Create the new login keychain 36 | expect <<- DONE 37 | set timeout -1 38 | spawn su $currentUser -c "security create-keychain login.keychain" 39 | echo "I just created the new keychain" 40 | # Look for prompt 41 | expect "*?chain:*" 42 | # send user entered password 43 | send "$PASSWORD\n" 44 | expect "*?chain:*" 45 | send "$PASSWORD\r" 46 | expect EOF 47 | DONE 48 | 49 | #Set the newly created login.keychain as the users default keychain 50 | su $currentUser -c "security default-keychain -s login.keychain" 51 | echo "this new keychain is default" 52 | 53 | # Sync keychain enabled 54 | defaults write com.apple.keychainaccess SyncLoginPassword -bool true 55 | -------------------------------------------------------------------------------- /resetLyncKeychain/deleteLynckeychain.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # deletes the lync keychain 3 | # Written by Matthew Bodaly 4 | # v. 1.0.1 27 July 2015 5 | # v. 1.1 4 Feb 2016 - changed currentUser method 6 | 7 | # Variables 8 | # Get the current user 9 | currentUser=$(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");') 10 | 11 | # Payload 12 | # Exit Lync 13 | sudo killall -KILL "Microsoft Lync" 14 | # Delete the keychain 15 | rm -rF "/Users/$currentUser/Library/Keychains/*@*" 16 | # Open Lync 17 | open -a /Applications/Microsoft\ Lync.app/ 18 | -------------------------------------------------------------------------------- /softwareupdate/softwareupdate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | softwareupdate --download --all 3 | -------------------------------------------------------------------------------- /toggleNotificationCenter/toggleNotificationCenter.sh: -------------------------------------------------------------------------------- 1 | # Disables/Enables notification center 2 | # Created 03/20/2014 by Owen Pragel 3 | 4 | sudo -v 5 | 6 | prefPath='/System/Library/LaunchAgents/com.apple.notificationcenterui KeepAlive' 7 | notificationOn=$(defaults read $prefPath) 8 | 9 | echo $notificationOn 10 | 11 | if [ "$notificationOn" -eq "1" ]; then 12 | echo "Disabling notification center!" 13 | defaults write "$prefPath" -boolean 0 14 | else 15 | echo "Enabling notification center!" 16 | defaults write "$prefPath" -boolean 1 17 | fi 18 | 19 | defaults read "$prefPath" 20 | 21 | exit 0 22 | -------------------------------------------------------------------------------- /toggleSSH/toggleSSH.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | sshStatus=$(sudo systemsetup -getremotelogin | awk '{print $3}') 3 | if [ "$sshStatus" == "On" ]; then 4 | systemsetup -f -setremotelogin off 5 | printf "Disabled SSH!" 6 | elif [ "$sshStatus" == "Off" ]; then 7 | systemsetup -f -setremotelogin on 8 | printf "Enabled SSH!" 9 | else 10 | printf "Error, SSH Status was: %s" "$sshStatus" 11 | fi 12 | -------------------------------------------------------------------------------- /toggleShowHiddenFiles/toggleShowHiddenFiles.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This script toggles whether the Finder shows hidden files. 3 | # Created by Owen Pragel on February 18th, 2014. 4 | 5 | if [[ $(defaults read com.apple.finder AppleShowAllFiles) != 1 ]]; then 6 | defaults write com.apple.finder AppleShowAllFiles -boolean true 7 | echo "Hidden files are now shown." 8 | else 9 | defaults write com.apple.finder AppleShowAllFiles -boolean false 10 | echo "Hidden files are now hidden." 11 | fi 12 | killall Finder 13 | killall Dock 14 | exit 0 15 | -------------------------------------------------------------------------------- /vpnMenuSetup/vpnSetup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This script adds the VPN item to the menu bar and enables the show time 3 | # connected and show status while connecting options. Tested on OS X 10.9. 4 | 5 | lastUser=$(defaults read /Library/Preferences/com.apple.loginwindow lastUserName) 6 | vpnMenuItem=$(defaults read "/Users/$lastUser/Library/Preferences/com.apple.systemuiserver" menuExtras | grep -o VPN) 7 | 8 | if [ "$vpnMenuItem" ]; then 9 | echo "VPN menu item is already on the status bar!" 10 | else 11 | sudo -u "$lastUser" defaults write "/Users/$lastUser/Library/Preferences/com.apple.systemuiserver" menuExtras -array-add "/System/Library/CoreServices/Menu Extras/VPN.menu" 12 | fi 13 | 14 | sudo -u "$lastUser" defaults write "/Users/$lastUser/Library/Preferences/com.apple.networkConnect" VPNShowStatus -bool true 15 | sudo -u "$lastUser" defaults write "/Users/$lastUser/Library/Preferences/com.apple.networkConnect" VPNShowTime -bool true 16 | killall SystemUIServer 17 | 18 | exit 0 19 | --------------------------------------------------------------------------------