Skip to content

Instantly share code, notes, and snippets.

View soundsnw's full-sized avatar

soundsnw

View GitHub Profile
#!/bin/zsh
export PATH=/usr/bin:/bin:/usr/sbin:sbin
recommendedUpdates=$(defaults read /Library/Preferences/com.apple.SoftwareUpdate.plist RecommendedUpdates | wc -l | awk '{print $1}')
if [[ recommendedUpdates -gt 2 ]]; then
echo "<result>True</result>"
else
echo "<result>False</result>"
fi
#!/bin/sh
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# Check if Preview.app is the default PDF reader
loggedInUser=$(scutil <<<"show State:/Users/ConsoleUser" | awk '/Name :/ && ! /loginwindow/ { print $3 }')
if [[ ! $(/usr/bin/sudo -u "$loggedInUser" /usr/local/orgutils/swda getUTIs | grep com.adobe.pdf | grep Preview) ]]; then
echo "<result>No</result>"
else
#!/bin/bash
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
#
# Check if Preview.app is the default PDF reader and change it back if it isn't
#
# Get OS version and logged in user
osVersion=$(/usr/bin/sw_vers -productVersion | awk -F. '{print $2}')
@soundsnw
soundsnw / promoteUser.sh
Last active January 26, 2020 17:59
Catalina compatible Zsh script to promote a standard user to an admin
#!/bin/zsh
emulate -LR zsh # Reset zsh options
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# Simple Zsh tempadmin v0.1
#
# Catalina compatible script for Jamf Self Service to grant standard
# users temporary admin rights.
#
# Modified by soundsnw, original code by Armin Briegel
sudo /usr/local/bin/vfuse -i ~/Downloads/osx-10.14.5-18F132.apfs.dmg --use-qemu /usr/local/Cellar/qemu/4.0.0/bin/qemu-img -n "macOS10.14.5" -s C02X225WJHD3 --hw-model MacBookAir7,2
<?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>EnterprisePoliciesEnabled</key>
<true/>
<key>DisableFeedbackCommands</key>
<true/>
<key>DisableFirefoxAccounts</key>
<true/>
<?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>PromotionalTabsEnabled</key>
<false/>
<key>WelcomePageOnOSUpdateEnabled</key>
<false/>
<key>MetricsReportingEnabled</key>
<false/>
#!/bin/bash
# Set time zone and enable network time server
sudo /usr/sbin/systemsetup -setusingnetworktime off
sudo /usr/sbin/systemsetup -settimezone "Europe/London"
sudo /usr/sbin/systemsetup -setnetworktimeserver time.euro.apple.com
#!/bin/bash
# Enable location services and automatic time zone configuration
/usr/bin/defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd LocationServicesEnabled -int 1
uuid=$(/usr/sbin/system_profiler SPHardwareDataType | grep "Hardware UUID" | cut -c22-57)
/usr/bin/defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd.$uuid LocationServicesEnabled -int 1
#!/bin/bash
# Enable location services and automatic time zone configuration
/usr/bin/defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd LocationServicesEnabled -int 1
uuid=$(/usr/sbin/system_profiler SPHardwareDataType | grep "Hardware UUID" | cut -c22-57)
/usr/bin/defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd.$uuid LocationServicesEnabled -int 1