Hello @martin-bo,
Thank you for reaching out to us.
Let’s begin with what went wrong while you executed the custom script.
After reboot, if your macOS startup disk has not yet been unlocked, macOS would not be running yet or connected to the internet to receive communication from any kind of MDM or agent. Therefore, resetting the macOS passcode remotely in such cases is, unfortunately, a no-go!
On the other hand, even if your macOS gets connected to a saved network and checks in with the portal, action status will be shown as pending when the custom script is executed via remote actions. Resetting the passcode is not viable in this case as well since the MDM agent would not be active.
Nevertheless, on the off chance that the standard methods to reset the password don’t work for you, boot your Mac into Recovery Mode to access the Terminal and enter the resetpassword command. If you have not enabled FileVault, have completely forgotten your password, don’t have a password hint, or cannot log in to the account using another admin account, this might be your best bet. For a detailed step-by-step walkthrough of the process, please check out how to reset Mac login password.
As a general practice, it is recommended that you enable FileVault on your devices to prevent unauthorized users from accessing information saved on your Macs. You can access FileVault-enabled devices/disks using either the device password or iCloud ID or via the recovery key.
Tip: You can check out how to manage FileVault to learn more about managing FileVault on your Macs using Hexnode.
Hope this answer helps you. Try it out, and keep me posted on any updates.
Emma Jones
Hexnode UEM