Skip to content

Instantly share code, notes, and snippets.

View TheRossRoss's full-sized avatar

TheRossRoss

View GitHub Profile
@talkingmoose
talkingmoose / jamfHelperProgress.sh
Last active March 16, 2021 18:33
Example for using JamfHelper to display progress during setup.
#!/bin/sh
/Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper \
-windowType fs \
-title "This is the title" \
-heading "This is the heading" \
-description "Completing Step 1 of 4" \
-icon /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/com.apple.cinema-display.icns &
sleep 2
@talkingmoose
talkingmoose / Enable all macOS software updates.bash
Last active May 31, 2024 08:45
The /Library/Preferences/com.apple.SoftwareUpdate.plist seems impervious to being managed via configuration profile (at least on macOS Mojave). While not enforced management, add this script to a Jamf policy and run it on a routine basis such as once per week on scoped Macs.
#!/bin/bash
/usr/bin/defaults write /Library/Preferences/com.apple.SoftwareUpdate.plist AutomaticCheckEnabled -bool TRUE
/usr/bin/defaults write /Library/Preferences/com.apple.SoftwareUpdate.plist AutomaticDownload -bool TRUE
/usr/bin/defaults write /Library/Preferences/com.apple.SoftwareUpdate.plist AutomaticallyInstallMacOSUpdates -bool TRUE
/usr/bin/defaults write /Library/Preferences/com.apple.SoftwareUpdate.plist ConfigDataInstall -bool TRUE
/usr/bin/defaults write /Library/Preferences/com.apple.SoftwareUpdate.plist CriticalUpdateInstall -bool TRUE
/usr/bin/defaults write /Library/Preferences/com.apple.commerce.plist AutoUpdate -bool TRUE
exit 0
@arekdreyer
arekdreyer / postinstall-for-Composer-for-DEPNotify.zsh
Last active April 5, 2024 21:36
Postinstall script for Jamf Composer to install DEPNotify with supporting scripts and a LaunchDaemon
#!/bin/zsh
## postinstall
pathToScript=$0
pathToPackage=$1
targetLocation=$2
targetVolume=$3
# This postinstall script for Composer creates the following
# A LaunchDaemon that starts a separate script to run a Jamf Pro policy command
@talkingmoose
talkingmoose / Location Information.zsh
Last active March 29, 2023 19:42
Add the following script to a Jamf Pro extension attribute to collect service provider location information based on public IP address when updating inventory.
#!/bin/zsh
# provide for Big Sur and earlier
xpath() {
# the xpath tool changes in Big Sur
if [[ $( /usr/bin/sw_vers -buildVersion) > "20A" ]]; then
/usr/bin/xpath -e "$@"
else
/usr/bin/xpath "$@"
fi
@talkingmoose
talkingmoose / "Early Adopter" extension attribute
Last active November 21, 2023 22:31
Self Service policy to enable end users to enroll their Macs into an "Early Adopter Program" or any other type of enrollment. Create a Smart Computer Group to identify early adopters and scope policies.
#!/bin/zsh
enrollmentStatus=$( /usr/bin/defaults read '/Library/Preferences/EarlyAdopter.plist' Enrolled )
echo "<result>$enrollmentStatus</result>"
@talkingmoose
talkingmoose / Report admin status.bash
Created August 26, 2020 22:29
Report if any macOS user accounts with admin privileges exist.
#!/bin/bash
# list all users with UIDs above 501
usersList=$( /usr/bin/dscl . -list /Users uid | /usr/bin/awk '$2 >= 501 { print $1 }' )
# test for admin
while IFS= read aUser
do
/usr/sbin/dseditgroup -o checkmember -u "$aUser" admin 1>/dev/null
@talkingmoose
talkingmoose / Create User Account.zsh
Last active April 3, 2024 10:01
Simple script to create a new macOS user account. Will not provide a SecureToken.
#!/bin/zsh
# new user account details
username="lapsadmin"
displayName="LAPS Admin"
password="P@55w0rd"
admin="yes"
hidden="yes"
# determine next available UID
@shurkin18
shurkin18 / druvainsyncactivationstatus.sh
Last active October 3, 2023 21:45
Checks if Druva inSync client is Active using UAPI and returns the status which can be used as JSS Computer Extension Attribute
#!/bin/bash
##########################################################################################################################################################################
##########################################################################################################################################################################
# Please note: this script requires jq JSON parser to be installed on the mac, otherwise the script won't work
# You can install jq JSON parser using brew by running this script, which will install brew and jq automatically (non-interactive):
# https://gist.github.com/shurkin18/62ec34967794a32f9d63615db881ab5c
#
# There is also an alternative way of running jq JSON parser, without installing the whole brew suite
# You can download the jq binary here: https://techstoreon.com/files/jq-osx-amd64
@shurkin18
shurkin18 / installbrewthenloadjq.sh
Last active May 23, 2023 11:55
Installs brew via script, then installs/loads jq JSON parser
###########################################################################################
# There is also an alternative way of running jq JSON parser, without installing the whole brew suite
# You can download the jq binary here: https://techstoreon.com/files/jq-osx-amd64
# Pre-load it to each mac via the policy and store it somewhere (in /var for example) and just point your script to it
# every time jq needs to be used
###########################################################################################
#!/bin/bash
# Checks if jq is not already present, and if not - installs brew via script, then installs/loads jq JSON parser
#
@talkingmoose
talkingmoose / Monterey-compatible Macs (regex).txt
Last active February 5, 2023 18:45
Regex looks for all Mac models compatible with macOS Monterey. May not be up-to-date with newly released models.
Model information: https://support.apple.com/en-us/HT212551
Published Date: June 24, 2022
Verification: https://regex101.com/r/OozSRv/9
1) Regex matches major identifier — Matches major model identifier numbers based on Apple's knowledge base article (more accurate):
(^Mac1[34]|MacBook(10|9)|MacBookAir(10|[7-9])|Macmini[7-9]|MacPro[6-7]|iMacPro1|iMac(1[6-9]|2[0-2])),\d|MacBookPro1(1,[45]|[2-8],\d)
2) Regex matches current or higher — Matches model identifiers based on Apple's knowledge base article and may match higher versions before this regex is updated (more future-proof).