Download a PDF of my slides and notes
Example code from my MacAdmins Conference at Penn State 2024 presentation.
#!/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' ) |
#!/bin/zsh | |
:<<ABOUT_THIS_EXTENSION_ATTRIBUTE | |
----------------------------------------------------------------------- | |
Written by:William Smith | |
Technical Enablement Manager | |
Jamf | |
bill@talkingmoose.net | |
https://gist.github.com/talkingmoose/4a2b613bf5273081459bc62c644193eb |
#!/bin/zsh | |
# set -x # show command | |
:<<ABOUT_THIS_SCRIPT | |
Written by:William Smith | |
Technical Enablement Manager | |
Jamf | |
bill@talkingmoose.net | |
https://gist.github.com/talkingmoose/4a950a715ad07ae3baecce2f46b0a7e5 |
Download a PDF of my slides and notes
Example code from my MacAdmins Conference at Penn State 2024 presentation.
#!/bin/zsh | |
# set -x # show command | |
# trap read debug # require a RETURN after each command | |
# download mobile device data from Jamf | |
xml=$( /usr/bin/curl \ | |
--silent \ | |
--url https://hw-model-names.services.jamfcloud.com/1/mobileDeviceModels.xml ) |
https://support.apple.com/guide/iphone/iphone-models-compatible-with-ios-18-iphe3fa5df43/ios | |
https://support.apple.com/guide/ipad/ipad-models-compatible-with-ipados-18-ipad213a25b2/ipados | |
https://www.apple.com/watchos/watchos-11/ | |
Published Date: June 10, 2024 | |
Updated November 1, 2024 | |
Verification: https://regex101.com/r/0UDJHk/7 | |
1) Exact regex — Matches major model identifier numbers based on Jamf's hardware model identifiers list (more accurate): |
https://www.apple.com/macos/macos-sequoia/ | |
Published Date: June 10, 2024 | |
Updated November 8, 2024 | |
Verification: https://regex101.com/r/bNOMXz/9 | |
1) Exact regex — Matches major model identifier numbers based on Apple's knowledge base article (more accurate): | |
^(Mac(1[3-6]|BookPro1[5-8]|BookAir(9|10)|Pro7)|iMac(Pro1|(19|2[01]))|Macmini[89]),\d+$ |
#!/bin/zsh | |
:<<ABOUT_THIS_SCRIPT | |
------------------------------------------------------------------------------- | |
Written by:William Smith | |
Technical Enablement Manager | |
Jamf | |
bill@talkingmoose.net | |
https://gist.github.com/talkingmoose/9f4638932df28c4bebde5dd47be1812a |
#!/bin/zsh | |
# get public IP address | |
publicIP=$( /usr/bin/curl http://ifconfig.me/ip \ | |
--location \ | |
--silent \ | |
--max-time 10 ) | |
# get GeoIP data | |
locationData=$( /usr/bin/curl http://ip-api.com/xml/$publicIP \ |