Skip to content

Instantly share code, notes, and snippets.

@talkingmoose
talkingmoose / List active Apple Accounts on macOS.szh
Created April 8, 2026 20:41
Jamf Pro extension attribute to read macOS accounts with active Apple Accounts
#!/bin/zsh
# create a list of local usernames (non-AD) with UIDs between 500 and 1024
usernames=( $( /usr/bin/dscl /Local/Default -list /Users uid | /usr/bin/awk '$2 >= 501 && $2 <= 1024 { print $1 }' ) )
for aUser in $usernames
do
echo "Evaluating user account $aUser"
# get home directory for user account
@talkingmoose
talkingmoose / DeleteLocalUsers.zsh
Last active July 29, 2025 13:53
Deletes all local user accounts except those specified in "keepUsers".
#!/bin/zsh
<<ABOUT_THIS_SCRIPT
-----------------------------------------------------------------------
Written by:William Smith
Professional Services Engineer
Jamf
[email protected]
https://gist.github.com/talkingmoose/67e5fb6b62855a169eca13e5efb3ba35
@talkingmoose
talkingmoose / 1. Welcome!.md
Last active August 14, 2025 20:57
MacAdmins Conference at Penn State workshop resources — July 15, 2025
@talkingmoose
talkingmoose / iOS 26, iPadOS 26, and watchOS 26 compatible devices (regex)
Last active April 7, 2026 19:42
Regex looks for all iPhone, iPad, and Apple Watch models compatible with iOS 26, iPadOS 26, and watchOS 26. May not be up-to-date with newly released models.
https://www.apple.com/os/ios/
https://www.apple.com/os/ipados/
https://www.apple.com/os/watchos/
Published Date: June 9, 2025
Updated: April 7, 2026
Verification: https://regex101.com/r/tYaV8u/5
@talkingmoose
talkingmoose / Tahoe-compatible Macs (regex)
Last active March 19, 2026 17:23
Regex looks for all Mac models compatible with macOS 26 Tahoe. May not be up-to-date with newly released models.
https://support.apple.com/en-us/122867
Published Date: March 10, 2026
Updated: March 19, 2026
Verification: https://regex101.com/r/YXAchM/9
1) Exact regex — Matches major model identifier numbers based on Apple's knowledge base article (more accurate):
^Mac((BookPro1(6,[124]|[78],\d)|(1[3-7]|BookAir10|mini9|Pro7),\d+))|iMac2[01],\d+$
@talkingmoose
talkingmoose / Create new Jamf Pro user account.zsh
Last active June 9, 2025 19:14
Jamf Pro account management scripts using the Jamf Pro API.
#!/bin/zsh
# set -x
:<<ABOUT_THIS_SCRIPT
-----------------------------------------------------------------------
Written by:William Smith
Partner Program Manager
Jamf
[email protected]
@talkingmoose
talkingmoose / Last Reboot.zsh
Last active December 20, 2024 00:53
Jamf Pro extension attribute to return date of last reboot. Create the EA with a Data Type of 'date'. This allows a Smart Group to use greater than and less than calculations.
#!/bin/zsh
# get last reboot date and time
lastReboot=$( /usr/bin/last -y reboot )
# extract date and time (e.g. Thu Dec 12 2024 08:35)
rebootTime=$( /usr/bin/awk -F '[[:space:]]{3,}' 'NR==1 { print $2 }' <<< "$lastReboot" )
# convert date and time to ISO date format
lastRebootISO=$( /bin/date -j -f "%a %b %e %Y %H:%M" "$rebootTime" '+%Y-%m-%d %I:%M:00' )
@talkingmoose
talkingmoose / Existing user accounts.zsh
Last active October 20, 2025 13:06
A Jamf Pro extension attribute to return whether a user account (hidden or visible) in a list of user accounts exists on a computer.
#!/bin/zsh
:<<ABOUT_THIS_EXTENSION_ATTRIBUTE
-----------------------------------------------------------------------
Written by:William Smith
Technical Enablement Manager
Jamf
[email protected]
https://gist.github.com/talkingmoose/4a2b613bf5273081459bc62c644193eb
@talkingmoose
talkingmoose / Back up Jamf Pro objects.zsh
Last active September 12, 2025 20:06
Download JSON or XML files for multiple Jamf Pro object types.
#!/bin/zsh
# set -x # show command
:<<ABOUT_THIS_SCRIPT
Written by:William Smith
Technical Enablement Manager
Jamf
[email protected]
https://gist.github.com/talkingmoose/4a950a715ad07ae3baecce2f46b0a7e5

AWK • SED • GREP: Together we can change anything!

Download a PDF of my slides and notes

awk sed grep circle logo

Example code from my MacAdmins Conference at Penn State 2024 presentation.

Battery cycle count