Skip to content

Instantly share code, notes, and snippets.

Avatar

Matthew Warren haircut

View GitHub Profile
@haircut
haircut / rename-computer-from-google-sheet.zsh
Created Sep 2, 2022
A minimal reimplementation of my Python script that renames computers using a Google sheet as a data source.
View rename-computer-from-google-sheet.zsh
#!/bin/zsh
# Replace with the ID of your Google Sheet
DOCUMENT_ID="XXX"
SHEET="https://docs.google.com/spreadsheets/d/${DOCUMENT_ID}/edit#gid=0/export?format=csv&id=${DOCUMENT_ID}&gid=0"
/usr/bin/curl -L "${SHEET}" -o /tmp/serial-sheet.csv
/usr/local/bin/jamf setComputerName -fromFile /tmp/serial-sheet.csv
@haircut
haircut / Disable-iCloud-Private-Relay.mobileconfig
Created Oct 28, 2021
Disables the iCloud Private Relay feature.
View Disable-iCloud-Private-Relay.mobileconfig
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>PayloadDisplayName</key>
<string>Restrictions</string>
<key>PayloadIdentifier</key>
View Self-Service-Reset-Privacy-Consent.py
@haircut
haircut / TCC-Testing-Privacy-Policy.mobileconfig
Created Aug 23, 2018
Largely disable consent prompts in a Jamf environment.
View TCC-Testing-Privacy-Policy.mobileconfig
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>Services</key>
<dict>
<key>Accessibility</key>
@haircut
haircut / Defer-Software-Updates.mobileconfig
Last active Aug 17, 2018
Manage ONLY Software Update Deferral delay
View Defer-Software-Updates.mobileconfig
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>PayloadDescription</key>
<string></string>
<key>PayloadDisplayName</key>
@haircut
haircut / tcc-reset.py
Last active Aug 3, 2022
Completely reset TCC services database in macOS
View tcc-reset.py
#!/usr/bin/python
"""
Completely reset TCC services database in macOS
Note: Both the system and individual users have TCC databases; run the script as both
a user and as root to completely reset TCC decisions at all levels.
2018-08-15: Resetting the 'Location' service fails; unknown cause
2018-08-16: Confirmed the 'All' service does not really reset _all_
services, so individual calls to each service is necessary.
@haircut
haircut / forget-saved-ssids.py
Last active Sep 24, 2018
Forget all saved SSIDs with whitelisting
View forget-saved-ssids.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Forget saved SSIDs with whitelisting
This script removes ALL saved SSIDs on a Mac except for those configured in a
whitelistsee SSID_WHITELIST variable below.
Thanks to @sepiemoini for suggestion of "MERGE_CURRENT_SSID" behavior
@haircut
haircut / modify-system-preferences-authorizations.py
Last active May 17, 2022
Backs up authdb, then modifies them so users can modify Energy Saver, Network, Printers & Scanners, Date & Time, Time Machine
View modify-system-preferences-authorizations.py
#!/usr/bin/python
'''
Modifies authorizations database to allow standard users to change select
system preferences.
A great guide to available authorization rights can be found at:
https://www.dssw.co.uk/reference/authorization-rights/index.html
USE AT YOUR OWN RISK
'''
View rename-computer.py
#!/usr/bin/python
'''
Rename computer from remote CSV using Jamf binary
Pass in the URL to your remote CSV file using script parameter 4
The remote CSV could live on a web server you control, OR be a Google Sheet
specified in the following format:
https://docs.google.com/spreadsheets/u/0/d/<document ID>/export?format=csv&id=<document ID>&gid=0
@haircut
haircut / bash-multiple-jamf-policies.sh
Last active Dec 28, 2020
Running multiple Jamf policies in bash or python; minimal examples
View bash-multiple-jamf-policies.sh
#!/bin/bash
# Policy IDs or custom trigger names
# Bash arrays are specified like the provided example; surround custom triggers with
# quotes, and leave policy ids as "bare" integers
POLICIES=( "custom" "triggers" 523 32 )
for i in "${POLICIES[@]}"; do
# test if array element is an integer, ie. a policy id
if [ "$i" -eq "$i" ] 2>/dev/null