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/bash
nameString="$4" # What to put in a name string
plistName="$5" # Name of the plist file (e.g., com.planetexpress.expendable.plist)
plistPath="$6" # Path to plist file (e.g., /Users/Shared/Careerchips)
currentDate=$(date +"%Y-%m-%d %H:%M:%S") # Creates date in format Jamf can use for date-based data type EA
defaults write $plistPath/$plistName name "$nameString" # Double-duty: will make plist if doesn't exist, then write the value!
defaults write $plistPath/$plistName date "$currentDate" # Date can be used in Jamf EA with "Date" data type.
#!/bin/bash
###
#
# Name: set-ea-value.sh
# Description: This script is designed to leverage the API to manually
# update the value of an EA on a computer record. Handy
# for situations where you don't need information actively
# pulled from a Mac but still want to set adhoc when needed.
# Values for jamfserver, API credentials, EA ID, EA Name,
@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!'
#!/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 / 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 (drkausalik@gmail.com)
# 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");')