I am working on creating a "make me an admin" script. I know there are already some out there I can use, but I wanted to create this one myself. What I have working now is a script that will first check if the user is already an admin user. If they are, a Jamf Helper window will appear informing them that they are already an admin user. They can then dismiss the window by clicking "OK". The policy stops running after they click "OK". If they are a standard user, the script will elevate them to admin, and a Jamf Helper window will appear with a countdown to what ever time we define in parameter 4. Once the timer runs out, the script runs the command to remove admin rights. I have this working really well. Now I'm trying to add some extra features. What I want to do is detect any new admin users that the user who is elevated to admin creates. They may do this to circumvent our policy of keeping users setup as standard. I had one idea to output the current admin users to a text file before the user is elevated to admin. After the admin rights are removed, another text file is generated containing the current admin users. I wanted to use the "diff" command to detect the new admin users. I'm having trouble with this. I know there has to be a better way to check the current admin users before the user is elevated to admin, and then check for new admin users after we take the admin rights away. What's a good way to do this? Once I figure this out, I can do further testing and put this into production. Unlike other "make me an admin" scripts, this one does not create a launchdaemon to handle the removal of admin rights. I found that approach to not be as reliable as what I am using in this script. My script will demote he user back to standard as soon as the timer runs out.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
