Skip to content

Instantly share code, notes, and snippets.

@rtrouton
rtrouton / gist:8830790
Last active August 29, 2015 13:56
Script for use with Casper's Self Service when deploying Canon printers. Script checks /Library/Printers/Canon/CUPSPS2/Utilities/Canon CUPS PS Printer Utility.app/Contents/Info.plist for the CFBundleVersion key value. If the value returned is less than the version of the current drivers, the print drivers are installed by a Casper policy before …
#!/bin/bash
# Check /Library/Printers/Canon/CUPSPS2/Utilities/Canon CUPS PS Printer Utility.app/Contents/Info.plist
# for the CFBundleVersion key value. It should match the version of the installed drivers.
installed_driver=$(defaults read "/Library/Printers/Canon/CUPSPS2/Utilities/Canon CUPS PS Printer Utility.app/Contents/Info" CFBundleVersion)
# Specify the current driver version
# by setting parameter 4 in the script
# on the JSS
@rtrouton
rtrouton / gist:8917576
Last active August 29, 2015 13:56
Script for use with Casper's Self Service when deploying Xerox printers. Script checks /Library/Printers/Xerox/PDEs/XeroxFeatures.plugin/Contents/Info.plist for the CFBundleShortVersionString key value. If the value returned is less than the version of the current drivers, the print drivers are installed by a Casper policy before the requested p…
#!/bin/bash
# Determine OS version
OSVERS=$(sw_vers -productVersion | awk -F. '{print $2}')
# Check /Library/Printers/Xerox/PDEs/XeroxFeatures.plugin for the CFBundleShortVersionString
# key value. It should match the version of the installed drivers.
installed_driver=$(defaults read "/Library/Printers/Xerox/PDEs/XeroxFeatures.plugin/Contents/Info" CFBundleShortVersionString)
installed_version=$(echo "$installed_driver" | sed 's/[\._-]//g')
@rtrouton
rtrouton / gist:9423156
Created March 8, 2014 00:29
AppleScript used as part of Payload-Free Package Creator Automator workflow
on run {input, parameters}
-- this repeat loop prevents empty strings from being submitted for the package name value
set q to 0
repeat while q is 0
set result to text returned of (display dialog "Enter a Name For Your Payload-Free Installer Package:" default answer "Payload-Free Installer Package")
if result is not "" then
set pkgname to result
set q to 1
end if
@rtrouton
rtrouton / gist:9715231
Created March 22, 2014 22:11
Expect script which automates running the fdesetup disable process. Script has been tested on both 10.8.5 and 10.9.2.
#!/usr/bin/expect
log_user 0
set password s3kr1tp4ssw0rd_or_recovery_key
spawn fdesetup disable
expect ": "
send "$password\n"
expect EOF
@rtrouton
rtrouton / gist:10310659
Last active August 29, 2015 13:58
Installer postinstall script that installs two Office 2011 installers (the Office 2011 14.3.0 full installer and the 14.4.1 update) and automatically fixes an issue with the volume license being wiped out by the 14.4.1 update
#!/bin/sh
# Determine working directory
install_dir=`dirname $0`
# Location of Microsoft Office Volume License file
office_license="$3/Library/Preferences/com.microsoft.office.licensing.plist"
@rtrouton
rtrouton / gist:10401357
Created April 10, 2014 16:49
Postinstall script for Microsoft Lync 14.0.8
#!/bin/bash
# Determine working directory
install_dir=`dirname $0`
#
# Installing Microsoft Lync
#
@rtrouton
rtrouton / gist:e4d66098937e8f21c25d
Created May 16, 2014 18:38
Script to fix the Users folder being hidden when iTunes 11.2 is installed and Find My Mac is enabled.
#!/bin/bash
# Detects if /Users is present
# If /Users is present, the
# chflags command will unhide it
if [[ -d "/Users" ]]; then
chflags nohidden "/Users"
fi
@rtrouton
rtrouton / gist:809fd31aa91501ba0124
Created June 1, 2014 18:04
Postinstall script for payload-free package which fixes the Users folder being hidden when iTunes 11.2 is installed and Find My Mac is enabled.
#!/bin/bash
# Detects if /Users is present
# If /Users is present, the
# chflags command will unhide it
if [[ -d "$3/Users" ]]; then
chflags nohidden "$3/Users"
fi
@rtrouton
rtrouton / gist:8032d209b3c810f0912f
Created June 4, 2014 14:22
Script that fixes the Casper MDM certificate on a Casper 9.x-managed Mac running 10.7.x or later.
#!/bin/bash
# Determine OS version
OSVERS=$(sw_vers -productVersion | awk -F. '{print $2}')
# Macs running 10.6.x or earlier are not able to use profiles.
# If the script detects that it is running on an OS earlier than
# 10.7.0, the script will exit at this point to avoid problems.
if [[ ${OSVERS} -lt 7 ]]; then
@rtrouton
rtrouton / com.company.fixcaspermdm.plist
Created June 15, 2014 00:15
LaunchDaemon to trigger /var/root/fixcaspermdm.sh. It runs on load and then once every 10 minutes.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.company.fixcaspermdm</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>/var/root/fixcaspermdm.sh</string>