Skip to content

Instantly share code, notes, and snippets.

@talkingmoose
talkingmoose / Download and Install Zoom Client for Mac.zsh
Last active November 6, 2024 00:54
Downloads and installs the latest available Zoom Client 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/talkingmoose/5336e69480d87014a4c2ea1d6ec0ea4e
@talkingmoose
talkingmoose / Add Computer to Static Group.bash
Created March 21, 2020 00:10
Prompts an administrator to choose a Jamf Pro static group and provide a computer serial number to add to that group.
#!/bin/bash
# server connection information
URL="https://talkingmoose.jamfcloud.com"
userName="API-Editor"
password="P@55w0rd"
httpErrorCodes="200 Request successful
201 Request to create or update object successful
400 Bad request
@talkingmoose
talkingmoose / Generate Random Firmware Password.bash
Last active July 20, 2021 15:30
Generate a randome EFI firmware password for each Mac and store in Jamf Pro. Note: This will be completely visible to all Jamf Pro users whose permissions allow access to Computers. Create an extension attritute with the first script.
#!/bin/bash
function logresult() {
if [ $? = "0" ] ; then
echo "$1"
else
echo "$2"
exit 1
fi
}
@talkingmoose
talkingmoose / Delete Extension Attributes.bash
Last active March 19, 2020 05:03
Evaluates each macOS extension attribute in Jamf Pro and deletes it if A) extension attribute is disabled and B) Description includes "delete after" date that is older than today's date. Useful in conjunction with "Disable Extension Attributes.bash".
#!/bin/bash
# server connection information
URL="https://talkingmoose.jamfcloud.com"
userName="API-Editor"
password="P@55w0rd"
httpErrorCodes="200 Request successful
201 Request to create or update object successful
400 Bad request
@talkingmoose
talkingmoose / Disable Extension Attributes.bash
Last active March 19, 2020 04:57
Takes a list of Extension Attribute names in a file and disables them. Adds a comment to each "2020-04-17 - OK to DELETE after this date if EA is still disabled.". Edit lines 4-9 with custom details. Useful in conjunction with "Delete Extension Attributes.bash"
#!/bin/bash
# server connection information
URL="https://talkingmoose.jamfcloud.com"
userName="API-Editor"
password="P@55w04d"
# number of days from now that the extension attribute can be safely deleted because of non-use
deleteInDays="30"
@talkingmoose
talkingmoose / Send iMessage text to list of phone numbers.applescript
Created February 23, 2020 17:42
Send an individual text message to each phone number in list.
tell application "Messages"
-- phone numbers must already exist in Contacts
set phoneNumbers to {"6125550000 John Smith", ¬
"6125551111 Mary Poppins", ¬
"6125552222 Larry Bud Melmon"}
-- https://stackoverflow.com/questions/11812184/how-to-send-an-imessage-text-with-applescript-only-in-provided-service
repeat with aNumber in phoneNumbers
set targetService to (1st service whose service type = iMessage)
@talkingmoose
talkingmoose / Download and Install VLC.zsh
Last active November 29, 2024 13:36
Downloads and installs the latest available VLC 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/84cbe002aca35c73032bccd230d8988a
@talkingmoose
talkingmoose / Add Keyboard Input Source.sh
Last active December 12, 2021 07:52
This example adds the Latin American keyboard as an input sourcce under System Preferences > Keyboard > Input Sources. Quit and reopen System Preferences if necessary to see the change.
#!/bin/zsh
# adds the additional input source to the list of input sources
/usr/bin/defaults write com.apple.HIToolbox AppleEnabledInputSources -array-add '<dict><key>InputSourceKind</key><string>Keyboard Layout</string><key>KeyboardLayout ID</key><integer>89</integer><key>KeyboardLayout Name</key><string>Latin American</string></dict>'
# enables the input menu in the menu bar
/usr/bin/defaults write com.apple.TextInputMenu visible -bool true
exit 0
@talkingmoose
talkingmoose / Mac software updates.txt
Created February 9, 2020 17:15
For 1:1 devices where administrators need to encourage users to update software or macOS versions.
IT is responsible for patch management, but users should be afforded the opportunity to install updates when convenient for them.
Communication is key. Where possible start with unobtrusive methods to notifiy users they need to install updates such as via email. In the email, include the deadline and a link to a policy to "update now". Use HTML formatting and graphics to help them understand what will happen and make the updates easy.
If email communications fail to get users to update, use a JamfHelper script in a policy to nag users once per day they need to update. Provide a button that links to the policy to "update now" and another button to "remind later". Users should not be able to close the nag until they click either of the buttons. Consider automatically closing the nag after 10 minutes and allowing the policy to reopen it at next checkin. After the user acknowledges the nag by clicking a button, write a time stamp to a file to prevent the nag from appearing the rest of the day. Alternatively, in
@talkingmoose
talkingmoose / Disable Notifications.bash
Last active February 5, 2020 15:29
Under Apple menu > System Preferences > Notifications > Do Not Disturb: Enables Do Not Disturb and sets time range from 7:01 a.m. to 7:00 a.m., effectively disabling macOS Notifications.
#!/bin/bash
# get currently logged in user
currentUser=$( /usr/bin/stat -f "%Su" /dev/console )
echo "Current user is $currentUser."
# set Do No Disturb for the current user to enabled between 7:01 a.m. and 7:00 a.m.
su "$currentUser" -c "defaults write ~/Library/Preferences/ByHost/com.apple.notificationcenterui.plist dndEnd -int 420" # minutes
su "$currentUser" -c "defaults write ~/Library/Preferences/ByHost/com.apple.notificationcenterui.plist dndStart -int 421" # minutes