Skip to content

Instantly share code, notes, and snippets.

View smashism's full-sized avatar
:shipit:
ship it!

emily smashism

:shipit:
ship it!
View GitHub Profile
@smashism
smashism / unmanage-devices-modern-auth.sh
Created April 4, 2024 16:04
Programmatically unmanage mobile devices via Jamf Pro API using bearer-auth token authentication.
#!/bin/bash
##########
# title: unmanage-devices-modern-auth.sh
# author: dr. k | @smashism on github
# date: 2024-03-28
# note: include jssIDs where specified, other server/cred details will
# prompt when run via terminal.app
# disclaimer: provided as-is with no warranty (express or implied). please test!
#
@smashism
smashism / unmanage-computers-modern-auth.sh
Last active April 4, 2024 16:03
Programmatically unmanage computers via Jamf Pro API using bearer-auth token authentication.
#!/bin/bash
##########
# title: unmanage-computers-modern-auth.sh
# author: dr. k | @smashism on github
# date: 2024-03-28
# note: include jssIDs where specified, other server/cred details will
# prompt when run via terminal.app
# disclaimer: provided as-is with no warranty (express or implied). please test!
#
@smashism
smashism / unmanage-mobile-devices.sh
Last active July 31, 2023 18:51
Automate marking mobile devices as unmanaged with the Jamf Pro Classic API
#!/bin/bash -x
deviceIDs=(
# put jssIDs here for mobile devices to remove
# ex. 12345678
0000
)
for id in "${deviceIDs[@]}"; do
/usr/bin/curl -sku "apiuser":"apipass" -X PUT -H "content-type: text/xml" "https://yourjamfpro.jamfcloud.com/JSSResource/mobiledevices/id/{$id}" -d "<mobile_device><general><managed>false</managed></general></mobile_device>"
@smashism
smashism / unmanage-computers.sh
Created July 31, 2023 18:49
Automate marking computers as unmanaged with the Jamf Pro Classic API
#!/bin/bash -x
deviceIDs=(
# put jssIDs here for computers to remove
# ex. 12345678
0000
)
for id in "${deviceIDs[@]}"; do
/usr/bin/curl -sku "apiuser":"apipass" -X PUT -H "content-type: text/xml" "https://yourjamfpro.jamfcloud.com/JSSResource/computers/id/{$id}" -d "<computer><general><remote_management><managed>false</managed></remote_management></general></computer>"
@smashism
smashism / random_sn
Last active December 10, 2022 15:52
random_sn
randomsn() {
managed_python3 -c "import string; from random import randint, sample; print('VM' + ''.join(sample((string.ascii_lowercase + string.digits),10)))"
}
#!/bin/bash
# Largely cobbled together from github.com/homebysix/jss-filevault-reissue/
# Thank you kindly to github.com/rderewianko for the idea
# Last modified 2016-11-28
#
# This script uses AppleScript to prompt for a hostname, then sets it on the computer.
# Recommended: a recon at the end of the QuickAdd enrollment workflow to make sure the JSS
# shows the correct username.
#
#!/bin/bash
# adapted by github.com/smashism
# created 2015-03-12
# updated 2016-11-07 - changed from cocoaDialog to jamfHelper
# lets user get browser versions for updating
#
# provided AS IS with no guarantee or warranty
# "You want the rest of the 'champaggin'?" "No… and it's pronounced 'cham-pain.'"
#!/bin/bash
###############################################################################
################################## VARIABLES ##################################
###############################################################################
dockutil=$(which dockutil)
currentUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ { print $3 }' )
#!/bin/bash
###
#
# Name: set-ea-value.sh
# Description: This script is designed to leverage the API to manually
# update the value of an EA on a computer record. Handy
# for situations where you don't need information actively
# pulled from a Mac but still want to set adhoc when needed.
# Values for jamfserver, API credentials, EA ID, EA Name,
#!/bin/sh
#
# adapted by github.com/smashism
# created 2015-03-12
# last updated 2016-11-07 - change from cocoaDialog to jamfHelper
# uses jamfHelper to display computer information to user
# helpful for troubleshooting if user can't find info themselves
#
# offered AS IS with no warranty or guarantee