Skip to content

Instantly share code, notes, and snippets.

View bryanzak's full-sized avatar

Bryan Pietrzak bryanzak

View GitHub Profile
@bryanzak
bryanzak / org.ops.mcx.blockapps.mobileconfig
Last active December 17, 2018 18:20
.mobileconfig profile to block access to Mail.app and Messages.app Format based on https://github.com/nmcspadden/Profiles/blob/master/TesterAccount.mobileconfig
<?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>PayloadIdentifier</key>
<string>org.ops.mcx.blockapps</string>
<key>PayloadRemovalDisallowed</key>
<true/>
<key>PayloadScope</key>
<string>System</string>
@bryanzak
bryanzak / SketchUpMake-15.3.plist
Created April 17, 2015 17:21
Munki pkginfo for SketchUp Make 2015. This package is a bit out of the ordinary as it has to copy a folder of three apps. This pkg info does that using the OEM downloaded disk image and properly handles uninstalling as well.
<?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>_metadata</key>
<dict>
<key>created_by</key>
<string>epietrb111</string>
<key>creation_date</key>
<date>2015-04-17T16:06:28Z</date>
@bryanzak
bryanzak / Office2011-14.4.2.plist
Created December 18, 2014 21:26
Many people constantly ask on the munki discussion group about Office 2011. The two files in this gist represent Office 2011. The first is the full Office 2011 SP4 OEM installer available directly from Microsoft. The second is the 14.4.7 update from autopkg (slightly modified as the autopkg recipe assumes an older base image not SP4, but that's …
<?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>_metadata</key>
<dict>
<key>created_by</key>
<string>epietrb111</string>
<key>creation_date</key>
<date>2014-09-14T22:21:34Z</date>
@bryanzak
bryanzak / AccountRenamer.command
Created August 22, 2014 04:12
This is a script we have used for a while to rename an Active Directory user account that is cached locally. When a teacher has a name change, their AD short name changes, but not the user ID. OS X doesn't like this. So this script is run by our field techs from an admin account to simply rename the account from old to new. The teacher can then …
#!/bin/bash
# AccountRenamer.command
#
# Interactive tool to rename an account from one name to another (like when a teacher gets renamed and their e account changes)
#
# HISTORY:
#
# 1.0 2013-03-25 bmp - initial release
@bryanzak
bryanzak / SafariPlugInPrefs.mobileconfig
Created March 20, 2014 02:17
Creating a profile (and installer package) from a plist. This gist has a number of pieces. From a plist it creates a profile and from the profile it creates an installer package. There are create shell scripts for each step and the installer package also has a postinstall script that installs the profile. In this particular example we're creatin…
<?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>PayloadContent</key>
<array>
<dict>
<key>PayloadContent</key>
<dict>
<key>com.apple.Safari</key>
@bryanzak
bryanzak / MunkiConfigure.sh
Last active August 29, 2015 13:57
A very simple example of how we configure Munki based on some information encoded in the computer name and some input from the building tech doing the configuration. This script is normally sent via ARD
#!/bin/bash
# Munki: Configure
role="school"
# valid options: school, staff, lab, classroom, cart
# #################################################
@bryanzak
bryanzak / MunkiSyncer.sh
Last active May 25, 2016 01:16
Munki Syncer - LaunchDaemon and script to auto sync a local munki_repo from a master on an smb server elsewhere within your organization once a day at a specified time. The server mount point could be automounted etc, but this script demonstrates mounting it dynamically if needed
#!/bin/bash
SERVER_MOUNT_PT="/Volumes/Munki"
SERVER_URL="//SERVICEACCOUNTNAME:SERVICEACCOUNTPASS@mastermunkiserver.yourorg.org/Munki"
we_mounted="false"
MUNKI_MASTER="/Volumes/Munki/Master Repository/munki_repo/"
MUNKI_LOCAL="/Users/Shared/munki_repo"
# important, trailing slash must be on source and must not be on destination
MountServer()
@bryanzak
bryanzak / SetStudentDesktop.py
Last active August 29, 2015 13:56
Mavericks does not respect MCX applied to com.apple.desktop.plist. This script - which can be called via a LaunchAgent for every user that logs in - will read the plist file and extract the desktop image set by MCX. Normally this key is found in Background > default > ImageFilePath but sometimes (perhaps related to not being managed? or Mission …
#!/usr/bin/env python
# 1.1 2014-03-04 BP rewrote to use complete.plist MCX since the pref file method was unreliable
# 1.0 2014-02-23 BP first release for use with 10.9.x base images
# based on gist published by Greg Neagle: https://gist.github.com/gregneagle/6957826
# only needed (and tested) on 10.9, but may work on older OS versions
from AppKit import NSWorkspace, NSScreen
from Foundation import NSURL
@bryanzak
bryanzak / ScriptRunner.sh
Last active May 9, 2017 21:44
Script Runner. This is a Launch Agent and script launcher so we can have a folder of scripts that are run anytime a user logs in. This is very barebones and not even remotely fancy, please feel free to share any feedback or suggestions you might have. Updated 2014-03-04 to support logging
#!/bin/bash
# save this file at /Library/yourorg/ScriptRunner.sh
script_path="${0}"
source_path=$(dirname "${script_path}")
chmod 777 "/var/log/yourorg-scriptrunner.log"
if [ -d "${source_path}/User Login Scripts" ]; then
@bryanzak
bryanzak / ARDFixer.command
Last active March 3, 2017 05:36
ARD Admin 3.7.1 Fixer - a script to cause ARD Admin to effectively "forget" all cached IP and DNS information for known computers. This deals with a problem in ARD Admin 3.7.1 where it seems to be too aggressive in caching this information
#!/bin/bash
SCRIPT_VERSION="1.0"
# some background info here: https://discussions.apple.com/message/24596710#24596710
# verify ARD Admin version
# quit ARD Admin - if running, wait 10 seconds
# kill cfprefsd
# rename plist
# sed