Skip to content

Instantly share code, notes, and snippets.

@talkingmoose
talkingmoose / Kill Running Apps.bash
Created June 27, 2019 16:07
Useful for killing all running applications that may prevent a restart for an upgrade. Killing apps does not allow for saving work. Use only as a last resort.
#!/bin/bash
# there's probably a better way to use lsappinfo to get the list of apps, but it's not well documented
appsList=$( /usr/bin/lsappinfo list | /usr/bin/grep -B 4 Foreground | /usr/bin/awk -F '\\) "|" ASN' 'NF > 1 { print $2 }' )
# kill each app by name except Finder
while IFS= read anApp
do
if [ "$anApp" != "Finder" ]; then
/usr/bin/pkill "$anApp"
@talkingmoose
talkingmoose / Set Computer PreStage Scope.bash
Last active July 18, 2024 13:00
As of Jamf Pro 10.14, the Jamf Pro API (/uapi) allows access to create and update scopes for computer PreStage Enrollments. Edit the information at the top and include a list of computer serial numbers for the COMPLETE scope. (The script replaces the scope list; it doesn't update.) Be sure to leave the opening and closing parentheses.
#!/bin/bash
# server connection information
URL="https://talkingmoose.jamfcloud.com"
username="API-Editor"
password="P@55w0rd"
# provide the Jamf Pro ID of the PreStage Enrollment; look in the URL when viewing the PreStage Enrollment
prestageID="1"
@talkingmoose
talkingmoose / Manage App Notifications.bash
Last active January 25, 2024 15:26
macOS Catalina will prompt users to allow Notifications from each app that makes a request. Administrators can manage these prompts using a Configuration Profile. If running Jamf Pro 10.19 or later, I suggest instead using this manifest: https://github.com/talkingmoose/jamf-manifests/blob/master/macOS%20Notifications%20(com.apple.notificationset…
#!/bin/bash
<<ABOUT_THIS_SCRIPT
-----------------------------------------------------------------------
Written by:William Smith
Professional Services Engineer
Jamf
[email protected]
https://gist.github.com/talkingmoose/9faf50deaaefafa9a147e48ba39bb4b0
@talkingmoose
talkingmoose / MegaPKGr.zsh
Last active June 26, 2023 05:37
The pkgbuild binary and Jamf Composer don't support adding single files of 8 GB or more to a package. Some apps like Install macOS Big Sur.app include files larger than 8 GB in their bundles. This script will create a deployable PKG file from apps whose bundles include those large files.
#!/bin/zsh
:<<ABOUT_THIS_SCRIPT
-------------------------------------------------------------------------------
Written by:William Smith
Professional Services Engineer
Jamf
[email protected]
https://gist.github.com/e9ed319226c6da30dd633725e48a97b0