change password (with checks) on various OSX devices

New Contributor


We have a wide variety of OSX devices (mac pro, imac and macbook pros ) that range from OSX 10.13 to OSX 11 .

We also have them in jamf some enrolled via Apple DEP and some invited via email. Most of them have filevault enabled.

Now we are required to change the password of a local account on it but we have to check if it has been updated or not.

How would we go about doing this via a script? We want to check if the password is the new one; if not, change it to the new one. 

Commands that are available to do this seem very limited on certain OSX versions.

Thanks for any help

We want to check the current password