Skip to content

Instantly share code, notes, and snippets.

View smashism's full-sized avatar
:shipit:
ship it!

emily smashism

:shipit:
ship it!
View GitHub Profile
#!/bin/sh
####################################################
## Use the legacy binary if running on < 10.7
####################################################
os_version=$(system_profiler SPSoftwareDataType -xml | grep -A 2 'os_version</key>' | grep -o 'OS X [0-9]\+.[0-9]\+' | grep -o '[0-9]\+.[0-9]\+')
major_version=$(echo $os_version | grep -o '[0-9]\+\.' | grep -o '[0-9]\+')
minor_version=$(echo $os_version | grep -o '\.[0-9]\+' | grep -o '[0-9]\+')
/usr/bin/tar -xf /private/tmp/JAMFQuickAdd/Binaries.tar.gz -C /private/tmp/JAMFQuickAdd
/bin/mkdir -p /usr/local/bin
#!/bin/bash
# Largely cobbled together from github.com/homebysix/jss-filevault-reissue/
# Thank you kindly to github.com/rderewianko for the idea
# Last modified 2016-11-28
#
# This script uses AppleScript to prompt for a hostname, then sets it on the computer.
# Recommended: a recon at the end of the QuickAdd enrollment workflow to make sure the JSS
# shows the correct username.
#
#!/bin/sh
# gets user and location data to populate computer record
# can run on policy at any time
# by emily
# last updated 2016-12-02
# Get the logged in users username
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");')
#!/bin/bash
###
#
# Name: nomad_update.sh
# Description: This script checks that NoMAD.app is installed, then does the following:
# 1- Checks for OS version to run correct launchctl method.
# 2- Unloads the NoMAD LaunchAgent in the user context.
# 3- Runs a .pkg installer of the new NoMAD version on secondary/helper policy
# with custom trigger 'update_nomad'.
#!/bin/bash
###
#
# Name: type_TouchBar.sh
# Description: Check for presense of Touch Bar Agent to see if a machine has
# a Touch Bar or not. Results can then be used to create a smart
# group based on type.
# Author: Emily Kausalik (drkausalik@gmail.com)
# Created: 2016-12-15
#!/bin/bash
if ioreg | grep "AppleEmbeddedOSSupportHost"; then
touch_bar="Yes"
else
touch_bar="No"
fi
echo "<result>$touch_bar</result>"
#!/bin/bash
###
#
# Name: recreate_keychain.sh
# Description: This script deletes the user's login.keychain, prompts
# the current user for their password, and then creates
# a new keychain. Uses Applescript dialog and jamfHelper
# for notifications and password prompt.
# Note: Password prompt via Applescript from Elliot Jordan (github.com/homebysix),
@smashism
smashism / previous_shutdown_cause
Created April 6, 2017 20:39
searching for shutdown causes
log show --predicate 'eventMessage contains "Previous shutdown cause"' --last 24h
#!/bin/sh
###
#
# Name: set_computerName.sh
# Description: This script is designed to set a computer name during DEP enrollment as follows:
# 1- Get logged-in username
# 2- Format the computer name as $username-mac
# 3- Set computer name/hostname/local hostname and NetBIOSName using formatted name
# 4- To be overly thorough, use jamf setcomputername to set name as well
@smashism
smashism / jamfhelper_prompt.sh
Created January 17, 2018 20:00
jamf helper prompt with title/subtitle/message
# run this in the "execute command" field of a policy in leu of the "complete" message if you want to add a title/subtitle
# can also be put in a bash/shell script
# use single-quotes if you use an exclamation point or other special characters, otherwise double-quotes are fine
/Library/Application\ Support/JAMF/bin/Management\ Action.app/Contents/MacOS/Management\ Action -title "Action Required: Do a thing" -subtitle "No really, this is required." -message 'Comply or get a Justin Bieber desktop background!'