Skip to content

Instantly share code, notes, and snippets.

@talkingmoose
talkingmoose / PromptToRenameComputer.sh
Last active May 11, 2021 22:38
Prompts user to enter a computer name up to 15 characters (Active Directory limit). Renames computer. Useful as part of a Jamf policy to configure a new Mac.
#!/bin/sh
# wait until the Dock process has started
while [[ "$setupProcess" = "" ]]
do
sleep 1
setupProcess=$( ps aux | pgrep "Dock" )
done
# prompt user for computer name and verify it is no more than 15 characters
@talkingmoose
talkingmoose / SetARDComputerInformationField.sh
Last active June 9, 2017 14:24
Generic script to set values ARD Info fields 1-4 by passing parameters $4 and $5 (Jamf) or $1 and $2 (Terminal). Useful for scoping in Jamf. Create companion Extension Attribute (using New From Template) to read each field. Defaults to setting ARD Info field 3 to "student".
#!/bin/sh
# use parameters passed to the script
# if no parameters are passed, use default settings
if [ "$4" = "" ] ; then
ardField="3"
else
ardField="$4"
fi
@talkingmoose
talkingmoose / com.apple.Safari.plist
Last active June 3, 2017 15:18
Opens Safari to homepage and all new windows and tabs to homepage.
<?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>AlwaysShowFavoritesBarInFullScreen</key>
<false/>
<key>HomePage</key>
<string>http://ahschools.us</string>
<key>NewTabBehavior</key>
<integer>0</integer>
@talkingmoose
talkingmoose / com.google.chrome.plist
Last active June 3, 2017 15:32
Based on management settings: http://www.chromium.org/administrators/policy-list-3 Do not ask to set as default browser Enable pop-up windows Disable autoupdate via web or P2P Sets homepage and new taps to open with homepage Disables prompt to ask to import settings from other browsers Shows home button Disable Welcome window.
<?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>DefaultBrowserSettingEnabled</key>
<false/>
<key>DefaultPopupsSetting</key>
<integer>1</integer>
<key>DeviceAutoUpdateDisabled</key>
<true/>
@talkingmoose
talkingmoose / remoteInstallPkg.sh
Last active June 14, 2017 13:40
Reads a CSV file of computer addresses, admin names and admin passwords. Attempts to copy a .pkg installer file to the computer and remotely install it. Original purpose was to avoid Jamf Recon for scanning a network to enroll devices and instead take a known list of machines and enroll them via QuickAdd.pkg.
#!/bin/sh
<<ABOUT_THIS_SCRIPT
-----------------------------------------------------------------------
Written by:William Smith
Professional Services Engineer
Jamf
bill@talkingmoose.net
https://github.com/talkingmoose/Casper-Scripts
@talkingmoose
talkingmoose / com.apple.loginwindow.plist
Created June 15, 2017 15:49
Active Directory's default notification settings alert users their passwords will expire in 30 days. This preference reduces that notification time to 14 days.
<?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>PasswordExpirationDays</key>
<string>14</string>
</dict>
</plist>
@talkingmoose
talkingmoose / DeleteComputerFromJSS.sh
Last active July 6, 2017 13:33
Create a JSS service account with Delete privileges for Computers only. Add this script to a workflow as necessary, such as "Before" in a Configuration for Casper Imaging. Only necessary where devices do not communicate with the JSS after imaging due to something like "device signature error".
#!/bin/sh
URL="https://jss.talkingmoose.net:8443"
userName="JSSAPI-Editor"
password="password"
serialNumber=$( system_profiler SPHardwareDataType | grep "Serial Number" | awk -F: '{ print $2 }' | xargs )
/bin/date "+%Y-%m-%d %H:%M:%S Current device serial number: $serialNumber"
@talkingmoose
talkingmoose / Update Extension Attribute.sh
Last active July 18, 2017 03:53
Prompts user for arbitrary data such as "Technician Enrollment" and then enters that into an extension attribute field in the JSS.
#!/bin/sh
URL="$4"
userName="$5"
password="$6"
serialNumber=$( system_profiler SPHardwareDataType | grep "Serial Number" | awk -F: '{ print $2 }' | xargs )
newName=$( /usr/bin/osascript -e 'text returned of (display dialog "Please, enter your LAN ID." default answer "" with title "Technician Setup" with icon file posix file "/System/Library/CoreServices/Finder.app/Contents/Resources/Finder.icns")' )
@talkingmoose
talkingmoose / DeleteCasperRemotePolicies.sh
Created July 19, 2017 22:29
each run of Casper Remote generates a new policy that's stored in the JSS. However, those policies are not visible and the JSS has no means to allow administrators to delete them. This script identifies all JSS policies with names in the format: '2013-08-07 at 4:18 PM | jsanchez | 1 Computer' and deletes them.
#!/bin/sh
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# Written by: William Smith
# Professional Services Engineer
# JAMF Software
# bill@talkingmoose.net
# https://github.com/talkingmoose/Casper-Scripts
#
@talkingmoose
talkingmoose / AddJamfPolicyExclusion.sh
Created July 26, 2017 00:56
Adds an item to to the Scope of a Jamf Policy's Exclusions list.
#!/bin/sh
<<ABOUT_THIS_SCRIPT
-----------------------------------------------------------------------
Written by:William Smith
Professional Services Engineer
Jamf
bill@talkingmoose.net