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
@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/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),
#!/bin/bash
if ioreg | grep "AppleEmbeddedOSSupportHost"; then
touch_bar="Yes"
else
touch_bar="No"
fi
echo "<result>$touch_bar</result>"
#!/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 ([email protected])
# Created: 2016-12-15
#!/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/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
# 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
####################################################
## 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/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
#
# NoMAD_LastPasswordExpireDate
# Checks NoMAD plist for LastPasswordExpireDate (AD password expiration)
# By github.com/smashism
# Last modified 2016-11-30
# Provided as-is with no support or warranty
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");')