Skip to content

Instantly share code, notes, and snippets.

View kdrwygvh's full-sized avatar
🏠
Working from home

John Hutchison kdrwygvh

🏠
Working from home
View GitHub Profile
@kdrwygvh
kdrwygvh / macOS Upgrade Erase Reinstall
Last active March 3, 2023 15:12
macOS Upgrader/Reinstaller/Eraser - Jamf Pro Required
#!/bin/zsh
#shellcheck shell=bash
# Title :macOS Download Upgrade Reinstall Erase.sh
# Description :Performs an upgrade, reinstall, or erase of macOS based on Jamf variables
# Author :John Hutchison
# Date :2022-12-23
# Contact :[email protected], [email protected]
# Version :1.3.4.3
# Notes : Updated to support disk spce checking on HFS+ filesystems
@kdrwygvh
kdrwygvh / Upgrade Erase Reinstall macOS
Last active April 30, 2021 10:54
Upgrades, Re-installs, or Erase Installs macOS
#!/bin/bash
# Title :macOS_Upgrade_Reinstall_Erase_Workflow.sh
# Description :Performs an upgrade, reinstall, or erase of macOS based on Jamf variables
# Author :John Hutchison
# Date :2021-04-19
# Contact :[email protected], [email protected]
# Version :1.3.2
# Notes : Updated to support disk spce checking on HFS+ filesystems
# Updated to use custom installer paths
#!/usr/bin/env zsh
# https://social.technet.microsoft.com/wiki/contents/articles/7608.srv-records-registered-by-net-logon.aspx
# https://docs.microsoft.com/en-us/troubleshoot/windows-server/networking/verify-srv-dns-records-have-been-created
declare -a activeDirectoryDomainNameTests=(
_ldap._tcp."$1".
_ldap._tcp.dc._msdcs."$1"
_ldap._tcp.pdc._msdcs."$1".
_kerberos._tcp. "$1" .
@kdrwygvh
kdrwygvh / SIPProtectedPaths.txt
Created January 6, 2021 14:00
SIP Protected Paths in macOS 11+
/Applications/Safari.app
/Library/Apple
/Library/Application Support/com.apple.TCC
/Library/CoreAnalytics
/Library/Filesystems/NetFSPlugins/Staged
/Library/Filesystems/NetFSPlugins/Valid
/Library/Frameworks/iTunesLibrary.framework
/Library/GPUBundles
/Library/KernelCollections
/Library/MessageTracer
@kdrwygvh
kdrwygvh / Randomize Clinical Trial Number.xml
Last active August 8, 2020 15:21
Jamf Pro Extension Attribute to generate random numbers for managed Macs. Macs can be grouped based on their random number range to achieve some random spread in the distribution of a given Jamf Pro object
<?xml version="1.0" encoding="UTF-8"?><extensionAttribute>
<displayName>Randomized Clinical Trial Number</displayName>
<description/>
<dataType>number</dataType>
<scriptContentsMac>#!/usr/bin/env zsh&#13;
&#13;
preferenceDomain=""&#13;
if [[ "$preferenceDomain" = "" ]]; then&#13;
preferenceDomain="com.github"&#13;
fi&#13;
#!/usr/bin/env zsh
### Collecting current user attributes ###
currentUser=$(/bin/ls -l /dev/console | /usr/bin/awk '{print $3}')
currentUserUID=$(/usr/bin/id -u "$currentUser")
currentUserHomeDirectoryPath="$(dscl . -read /Users/$currentUser NFSHomeDirectory | awk -F ': ' '{print $2}')"
##########################################################################################
##Box Edit PostInstall
sudo -u "$currentUser" mkdir -p "$currentUserHomeDirectoryPath/Library/Application Support/Box/Box Edit/PKG Installer log/"
#!/usr/bin/env zsh
### Collecting current user attributes ###
currentUser=$(/bin/ls -l /dev/console | /usr/bin/awk '{print $3}')
currentUserUID=$(/usr/bin/id -u "$currentUser")
currentUserHomeDirectoryPath="$(dscl . -read /Users/$currentUser NFSHomeDirectory | awk -F ': ' '{print $2}')"
##########################################################################################
if [[ "$currentUser" = "root" ]]; then
echo "No user is logged in, wait until later to perform Box preinstall/postinstall
@kdrwygvh
kdrwygvh / Enable Apple Remote Desktop and Privileges.sh
Created January 8, 2020 14:43
Enable Apple Remote Desktop and Configure Privileges
#!/bin/sh
####################################################################################################
#
# Copyright (c) 2010, JAMF Software, LLC. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
@kdrwygvh
kdrwygvh / Storage Medium.sh
Created January 8, 2020 13:59
Storage Medium
#!/bin/sh
echo "<result>$(system_profiler SPStorageDataType | awk '/Medium Type/ {print $3}' | head -1)</result>"
@kdrwygvh
kdrwygvh / User Idle Time.sh
Last active January 7, 2020 15:46
User Idle Time
#!/bin/sh
currentUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ && ! /loginwindow/ { print $3 }' )
echo "<result>$(w -h "$currentUser" | head -1 | awk '{print $5}')</result>"