Skip to content

Instantly share code, notes, and snippets.


William Smith talkingmoose

View GitHub Profile
talkingmoose / Jamf Pro Provisioning 2.zsh
Created Nov 16, 2020
Runs when called by a Jamf Pro policy triggered by Enrollment Complete. Installs third party software that Apple's Volume Purchase Program (VPP) cannot install and runs maintenance routines (bind to Active Directory, set time zone etc.).
View Jamf Pro Provisioning 2.zsh
Written by:William Smith
Professional Services Engineer
talkingmoose / SearchLDAP
Created Oct 22, 2020
Syntax for looking up user information from a non-bound LDAP directory.
View SearchLDAP
# -x = use simple authentication instead of SASL
# -b = search base
# -D = user principal name (UPN) of authenticating user
# -w = password of authenticating user
# look up a user's manager's distinguished name
talkingmoose / MegaPKGr.zsh
Last active Feb 24, 2021
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 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.
View MegaPKGr.zsh
Written by:William Smith
Professional Services Engineer
talkingmoose / Hide Wi-Fi
Last active Oct 28, 2020
Quits the Wi-Fi menu item for the current user. Effectively unchecks the "Show Wi-Fi status in menu bar" item in System Preferences > Network.
View Hide Wi-Fi
# get current logged in user
currentUser=$( /usr/bin/stat -f "%Su" /dev/console )
echo "Current user is $currentUser"
# get current user home folder path
homeFolder=$( /usr/bin/dscl . read /Users/talkingmoose NFSHomeDirectory | /usr/bin/awk -F ": " '{ print $2 }' )
echo "Current user home folder is $homeFolder"
talkingmoose / Report admin status.bash
Created Aug 26, 2020
Report if any macOS user accounts with admin privileges exist.
View Report admin status.bash
# list all users with UIDs above 501
usersList=$( /usr/bin/dscl . -list /Users uid | /usr/bin/awk '$2 >= 501 { print $1 }' )
# test for admin
while IFS= read aUser
/usr/sbin/dseditgroup -o checkmember -u "$aUser" admin 1>/dev/null
talkingmoose / Report unknown network services.zsh
Created Aug 3, 2020
Compares known and current network services and creates an unknown network services list.
View Report unknown network services.zsh
# list of known network services that should be excluded from results
defaultNetworkServices="An asterisk (*) denotes that a network service is disabled.
USB-C Dock Ethernet
Apple USB Ethernet Adapter
iPhone USB
Bluetooth PAN
Thunderbolt Bridge"
talkingmoose / "Early Adopter" extension attribute
Last active Nov 1, 2020
Self Service policy to enable end users to enroll their Macs into an "Early Adopter Program" or any other type of enrollment. Create a Smart Computer Group to identify early adopters and scope policies.
View "Early Adopter" extension attribute
enrollmentStatus=$( /usr/bin/defaults read '/Library/Preferences/EarlyAdopter.plist' Enrolled )
echo "<result>$enrollmentStatus</result>"
talkingmoose / Delete account from current user's Internet
Last active Jul 29, 2020
Example for removing specific account from System Preferences > Internet Accounts for the current user.
View Delete account from current user's Internet
# get name of currently logged in user
currentUser=$( /usr/bin/stat -f "%Su" /dev/console )
echo "Current user is $currentUser."
# get current user's home folder
homeFolder=$( /usr/bin/dscl . read "/Users/$currentUser" NFSHomeDirectory | /usr/bin/awk -F ": " '{ print $2 }' )
# remove account by description name from Accounts sqlite database
/usr/bin/sqlite3 "$homeFolder/Library/Accounts/Accounts4.sqlite" 'DELETE FROM ZACCOUNT WHERE ZACCOUNTDESCRIPTION = "Exchange"'
talkingmoose / Make new Outlook Address Book and Contact.applescript
Created Jul 23, 2020
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.
View Make new Outlook Address Book and Contact.applescript
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:"", type:work}, {address:"", type:home}}} at address book "Company Contacts" of exchange account 1
end tell
talkingmoose / add-AD-user-data-to-Jamf-Pro.ps1
Last active Jul 1, 2020
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.
View add-AD-user-data-to-Jamf-Pro.ps1
# 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