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/bash
loggedInUser=$( /usr/sbin/scutil <<< "show State:/Users/ConsoleUser" | awk -F’: ‘ ‘/[[:space:]]+Name[[:space:]]:/ { if ( $2 != "loginwindow" ) { print $2 }}’ )
sudo -u $loggedInUser chflags -R nouchg /Users/$loggedInUser
diskutil resetUserPermissions / $loggedInUser
exit 0
#!/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}')
#!/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
@soundsnw
soundsnw / standard-user-access.sh
Created June 11, 2019 12:33
Give macOS standard users access to networking, printing and more
#!/bin/sh
#
# Provides standard user access to preference panels they would expect to be able to access, and might need access to.
#
# Provides standard users access to system preferences
/usr/bin/security authorizationdb write system.preferences allow
#!/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
@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/>