Skip to content

Instantly share code, notes, and snippets.

@talkingmoose
talkingmoose / iOS and iPadOS 17 compatible devices (regex)
Last active June 22, 2023 16:28
Regex looks for all iPhone and iPad models compatible with iOS or iPadOS 17. May not be up-to-date with newly released models.
View iOS and iPadOS 17 compatible devices (regex)
https://www.apple.com/ios/ios-17-preview/
https://www.apple.com/ipados/ipados-17-preview/
Published Date: June 5, 2023
Verification: https://regex101.com/r/m9HV8T/3
1) Exact regex — Matches major model identifier numbers based on Jamf's hardware model identifiers list (more accurate):
^iPhone1[1-5],\d|iPad([7-9]|1[1-4]),\d+$
@talkingmoose
talkingmoose / Sonoma-compatible Macs (regex)
Last active October 30, 2023 16:14
Regex looks for all Mac models compatible with macOS Sonoma. May not be up-to-date with newly released models.
View Sonoma-compatible Macs (regex)
https://support.apple.com/en-us/HT213772
Published Date: September 25, 2023
Verification: https://regex101.com/r/GCfKMt/8
1) Exact regex — Matches major model identifier numbers based on Apple's knowledge base article (more accurate):
^(Mac(1[34]|BookPro1[5-8]|BookAir([89]|10)|Pro7)|iMac(Pro1|(19|2[01]))|Macmini[89]),\d+$
2) Current or higher regex — Matches model identifiers based on Apple's knowledge base article and may match higher versions before this regex is updated (more future-proof).
@talkingmoose
talkingmoose / Managed Apple admin password last set time.zsh
Created June 2, 2023 20:07
Reads managed Apple admin account for date and time of last password change and reports in ISO 8601 format.
View Managed Apple admin password last set time.zsh
#!/bin/zsh
# get LAPS account username
lapsUsername=$( /usr/libexec/PlistBuddy -c "Print :Users:0:shortName" /var/db/ConfigurationProfiles/Settings/.setupUser )
# read LAPS account for password information
userPasswordInfo=$( /usr/bin/dscl . read "/Users/$lapsUsername" accountPolicyData | /usr/bin/tail -n +4 )
# extract Unix epoch date from account password information
passwordChangeDateEpoch=$( /usr/bin/xpath -e '//key[text()="passwordLastSetTime"]/following-sibling::real[1]/text()' 2>/dev/null <<< "$userPasswordInfo" )
@talkingmoose
talkingmoose / Download and Install Jamf Connect.zsh
Last active October 11, 2023 17:34
Downloads and installs the latest available Jamf Connect software for Mac directly on the client. This avoids having to manually download and store an up-to-date installer on a distribution server every month.
View Download and Install Jamf Connect.zsh
#!/bin/zsh
:<<ABOUT_THIS_SCRIPT
-------------------------------------------------------------------------------
Written by:William Smith
Partner Program Manager
Jamf
bill@talkingmoose.net
https://gist.github.com/talkingmoose/94882adb69403a24794f6b84d4ae9de5
@talkingmoose
talkingmoose / Active Directory Users.zsh
Last active May 31, 2023 16:45
Jamf Pro extension attribute to list all Active Directory users on a computer.
View Active Directory Users.zsh
#!/bin/zsh
adUsers=""
# get list of usernames
userList=$( /usr/bin/dscl . list /Users UniqueID | /usr/bin/awk '$2 > 500 { print $1 }' )
# create list of Active Directory usernames
@talkingmoose
talkingmoose / Deploy Choices XML.zsh
Created May 5, 2023 15:33
This script when edited with the Apple Installer package name and app bundle identifier(s) will deploy a choices.xml file to exlude an installer choice during package installation.
View Deploy Choices XML.zsh
#!/bin/zsh
:<<ABOUT_THIS_SCRIPT
-----------------------------------------------------------------------
Written by:William Smith
Partner Program Manager
Jamf
bill@talkingmoose.net
https://gist.github.com/talkingmoose/3926e86332e32eb7d05a161c3f7e8f69
@talkingmoose
talkingmoose / Retrieve LAPS Password.zsh
Last active September 1, 2023 18:05
Retrieves the Jamf Pro LAPS password for the current computer. The script assumes a desktop administrator is operating the computer. The administrator will open Self Service, authenticate, and run the policy with the script.
View Retrieve LAPS Password.zsh
#!/bin/zsh
# set -x
:<<ABOUT_THIS_SCRIPT
-----------------------------------------------------------------------
Written by:William Smith
Partner Program Manager
Jamf
bill@talkingmoose.net
@talkingmoose
talkingmoose / Download and Install Microsoft product.zsh
Created February 13, 2023 20:51
Downloads and installs the latest available Microsoft product specified directly on the client. This avoids having to manually download and store an up-to-date installer on a distribution server every month.
View Download and Install Microsoft product.zsh
#!/bin/zsh
:<<'ABOUT_THIS_SCRIPT'
-----------------------------------------------------------------------
Written by:William Smith
Partner Program Manager
Jamf
bill@talkingmoose.net
https://gist.github.com/b6637160b65b751824943ede022daa17
@talkingmoose
talkingmoose / Ventura-compatible Macs (regex).txt
Created February 5, 2023 18:41
Regex looks for all Mac models compatible with macOS Ventura. May not be up-to-date with newly released models.
View Ventura-compatible Macs (regex).txt
https://support.apple.com/en-us/HT213264
Published Date: October 24, 2022
Verification: https://regex101.com/r/nRkAFo/2
1) Exact regex — Matches major model identifier numbers based on Apple's knowledge base article (more accurate):
^(Mac(1[34]|BookPro1[4-8]|BookAir([89]|10)|Pro7|Book10)|iMac(Pro1|(1[89]|2[01]))|Macmini[89]),\d+$
2) Current or higher regex — Matches model identifiers based on Apple's knowledge base article and may match higher versions before this regex is updated (more future-proof).
@talkingmoose
talkingmoose / Jamf Pro Computer EraseDevice.zsh
Last active May 17, 2023 12:22
Use Jamf Pro Classic API to send EraseDevice command (Erase All Content and Settings on macOS Monterey and newer) to one or multiple computers by Jamf Pro ID. This script doesn't support computers locked using Device Lock with unique passcodes.
View Jamf Pro Computer EraseDevice.zsh
#!/bin/zsh
:<<ABOUT_THIS_SCRIPT
-------------------------------------------------------------------------------
Written by:William Smith
Partner Program Manager
Jamf
bill@talkingmoose.net
https://gist.github.com/d8dbdbc920cbaddd7d60f44f17bf268a