Administrators remain admin using demote script

sk25
Contributor

Guys,

I'm using promote script to make standard users as an administrator. And my requirement is, not to demote the user who are all already an administrator.

I've logic here correct me If I'm wrong. 

When I execute the promote script, I will be storing the log saying 'You are already administrator' if the script executed on the administrator user profile. Taking the log as an input and making the condition that if the log has this message then no action required on demote script. 

And anyone help me with the script how to read the string in the file and make that has a condition. Thanks for understanding.

2 REPLIES 2

AJPinto
Honored Contributor III

Can you share the script? I'm going to wager you need to add logic to read who is in the Admin group BEFORE any changes are made, and to save that information as a variable and save it somewhere. Then to write a LaunchAgent to call a script to demote all users, except those stored in that variable. 

@AJPinto You need a demote script?