Posted on 11-11-2022 12:04 PM
Here is how I check for macOS updates, install the recent available and reset Jamf Connect login window.
- Requires a local admin username, PID and password.
Create a Script in Jamf Pro.
#!/bin/zsh -i
vers=$(sw_vers -productversion)
install=$(softwareupdate --list-full-installer | sed -n '3p' | tr : '\n' | tr , '\n')
name=$(echo "$install" | sed -n '2p' | sed -e 's/^[ \t]*//')
number=$(echo "$install" | sed -n '4p' | sed -e 's/^[ \t]*//')
if ls /Applications/Install\ macOS* 1> /dev/null 2>&1 ; then
rm -rf /Applications/Install\ macOS*
fi
if [[ "$number" > "$vers" ]] ; then
echo "Installer available $name $number."
launchctl asuser <ADMINPID> sudo -u <ADMINUSERNAME> softwareupdate --fetch-full-installer --full-installer-version $number
if [[ -d "/Applications/Install $name.app" ]]; then
echo <ADMINPASSWORD> | "/Applications/Install $name.app/Contents/Resources/startosinstall" --agreetolicense --forcequitapps --nointeraction --user <ADMINUSERNAME> --stdinpass
fi
reset.jamf.connect.plist copy to /Library/LaunchDaemons
sudo launchctl load /Library/LaunchDaemons/reseet.jamf.connect.plist
<?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>Label</key>
<string>reset.jamf.connect</string>
<key>ProgramArguments</key>
<array>
<string>/bin/zsh</string>
<string>/Library/Scripts/Register User/reset.jamf.connect.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>UserName</key>
<string>root</string>
</dict>
</plist>
reset.jamf.connect.sh copy to /Library/Scripts/Register User/reset.jamf.connect.sh
if ! (/usr/local/bin/authchanger -print) | grep -q "JamfConnectLogin:Success"; then
/usr/local/bin/authchanger -reset -JamfConnect
killall loginwindow
fi
Make sure to change file permissions on these files and make the sh file executable (chmod x+ reset.jamf.connect.sh)
I made a PKG that will install these files on client computers and launchctl /Library/LaunchDaemons/reset.jamf.connect.plist.
Created a policy to run macOS Update Check script once a week on all computers.
Any time when the computer is rebooted, LaunchDaemon run reset.jamf.connect.plist which runs the script to check if Jamf Connect loginwindow is set as the default.
Posted on 11-16-2022 05:39 AM
The procedure I wrote is for deploying from Jamf to client computers and is zero touch method.
I’m not going to physical touch 200+ macs just to update them!