Skip to content

Instantly share code, notes, and snippets.

@talkingmoose
talkingmoose / Make new Outlook Address Book and Contact.applescript
Created July 23, 2020 21:28
Useful for when an admin needs to add a list of "safe" addresses to a user's Contacts but wants to keep them separate from the user's own contacts.
tell application "Microsoft Outlook"
make new address book in exchange account 1 with properties {name:"Company Contacts"}
make new contact with properties {first name:"Martin", last name:"Moose", email addresses:{{address:"[email protected]", type:work}, {address:"[email protected]", type:home}}} at address book "Company Contacts" of exchange account 1
end tell
@talkingmoose
talkingmoose / add-AD-user-data-to-Jamf-Pro.ps1
Last active March 11, 2022 04:02
Reads a pre-defined Advanced Computer Search and gets list of newly enrolled devices and their usernames. Looks up usernames in Active Directory and retrieves more user detail. Populates devices records with additional user in Jamf Pro.
# INSTRUCTIONS
# Create a folder on the Administrator Desktop named "Project"
# Run the script to generate the AES key
# Run the script to generate the Active Directory encrypted password file
# Run the script to generate the Jamf Pro encrypted password file
# Update the following variables:
# JamfProServer
@talkingmoose
talkingmoose / Big Sur-compatible Macs (regex)
Last active June 7, 2023 19:50
Regex looks for all Mac models compatible with macOS Big Sur. May not be up-to-date with newly released models.
Model information: https://support.apple.com/en-us/HT211238
Published Date: October 25, 2021
Verification: https://regex101.com/r/7nnq4T/13
This regex is complete. Apple is no longer creating Big Sur compatible Macs.
(MacBook(10|9|8)|MacBookAir(10|[6-9])|MacBookPro1[1-7]|Macmini[7-9]|MacPro[6-7]|iMacPro1),\d|iMac(14,4|1[5-9],\d|2[01],\d)
Resources for Jamf's "Script 201 for Apple Admins" webinar on June 18, 2020.
"Scripting 101 for Apple Admins" Webinar
Video: https://www.jamf.com/resources/webinars/scripting-101-for-apple-admins/
Discussions: https://www.jamf.com/jamf-nation/discussions/32391/scripting-101-for-apple-admins-webinar
PDF reference: https://www.jamf.com/blog/scripting-basics-for-everyone/
Time Zone script:
https://www.jamf.com/jamf-nation/third-party-products/files/836/settimezone-sh-set-the-time-zone
@talkingmoose
talkingmoose / Another Rename Computer Script.bash
Last active December 23, 2021 21:18
Jamf, Catalina and osascript compatible. Prompts to choose a site and enter an asset tag before renaming the Mac and then updating Jamf Pro.
#!/bin/sh
# wait until the Dock process has started
while [[ "$setupProcess" = "" ]]
do
echo "Waiting for Dock"
setupProcess=$( /usr/bin/pgrep "Dock" )
sleep 3
done
@talkingmoose
talkingmoose / Download and Install Mozilla Firefox.zsh
Last active August 27, 2024 18:39
Downloads and installs the latest available Mozilla Firefox for Mac software directly on the client. This avoids having to manually download and store an up-to-date installer on a distribution server. Includes an optional checksum for added security.
#!/bin/zsh
:<<ABOUT_THIS_SCRIPT
-------------------------------------------------------------------------------
Written by:William Smith
Professional Services Engineer
Jamf
[email protected]
https://gist.github.com/b99a43948c4784631e9ad60eb714c776
@talkingmoose
talkingmoose / Match Version Number or Higher.bash
Last active March 20, 2025 14:08
Generates a regular expression (regex) that matches the provided version number or higher. Useful for Jamf Pro's "matches regex" operator in searches and smart groups where the results need to be the current version of an app or higher.
#!/bin/bash
<<ABOUT_THIS_SCRIPT
-------------------------------------------------------------------------------
Written by:William Smith
Professional Services Engineer
Jamf
[email protected]
https://gist.github.com/2cf20236e665fcd7ec41311d50c89c0e
@talkingmoose
talkingmoose / Get App Install Date.zsh
Created April 10, 2020 18:19
Returns the installation date for an app installed uisng an Apple Installer package. In Terminal run /path/to/script /path/to/Bundle.app (drag the app into the window).
#!/bin/bash
# in Terminal run /path/to/script /path/to/Bundle.app
installedApp=$1
# get the app's bundle identifier
bundleID=$( /usr/bin/defaults read "$installedApp/Contents/Info.plist" CFBundleIdentifier )
# get the installation epoch date for the bundle identifier
installEpoch=$( /usr/sbin/pkgutil --pkg-info="$bundleID" | /usr/bin/grep "install-time" | /usr/bin/awk '{ print $2 }' )
@talkingmoose
talkingmoose / How to Support a Remote Workforce.md
Last active May 19, 2020 05:41
Resources from our April 2, 2020, webinar
@talkingmoose
talkingmoose / Location Information.zsh
Last active December 3, 2024 15:29
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