bvanpeski / unActivationLock

A tool for ensuring user-based activation lock remains off.
Apache License 2.0
68 stars 6 forks source link
activation-lock findmy macos

UnActivationLock

A tool for helping prevent user-based Activation Lock issues.

This script checks to see if a machine is Activation locked, and if so, it will try to determine if the currently logged in user is the one associated with the activation lock, and prompt the user to turn off Find My Mac. If the device is enrolled in an MDM, this will give that MDM solution enough time to prevent future Activation Lock and gather an Activation Lock bypass code should the Activation Lock ever get turned back on. There is also an option to always prompt a user to log out of Find My Mac regardless of Activation Lock status.

This script is designed to assist with existing devices that were enrolled into an MDM when a user on the device is already logged into iCloud with Find My Mac enabled at the time of enrollment. To prevent activation lock on NEW enrollments, I highly suggest you enroll your devices using Automated Device Enrollment. That is the best way to avoid activation lock from happening in the first place. You can find more thoughts around user-based Activation Lock over on the blog.

This script has been tested (somewhat) on macOS Montery 12.4 and macOS Ventura 13.1 on M1 and Intel Macs. This script has not been tested at scale or with multiple MDMs. iCloud can be a fickle thing sometimes, so this script is provided with no guarantees and the understanding that you use it at your own risk.

Customizing the dialog

While this script was designed with Kandji in mind, it is designed to be plug-and-play for just about any MDM.

I’ve included three options for messaging the end-user leveraging the Kandji CLI, Swift Dialog, or standard osascript, but feel free to add your messaging binary of choice if you prefer using your native MDM messaging system or a different third party messaging tool.

I've included the ability to add an appIcon to the messaging. You can deploy and integrate your own custom icon, or use one that already exists on the machine. Here are a few suggestions: /System/Library/PrivateFrameworks/AOSUI.framework/Versions/A/Resources/AppleID.icns /System/Library/PrivateFrameworks/AOSUI.framework/Versions/A/Resources/findmy.icns /System/Library/PrivateFrameworks/AOSUI.framework/Versions/A/Resources/iCloud.icns

I've set the FindMy icon as the default, since that helps the end-user visually understand the section of System Settings they need to be looking for, but feel free to customize to suit your needs.

Pro Tip: osascript dialogs look pretty boring and dated these days in macOS, but adding a path to an app icon goes a long ways towards making it look less terrible.

Troubleshooting

FAQ

What's Next?