Skip to main content
Question

Administrators remain admin using demote script

  • September 12, 2023
  • 2 replies
  • 30 views

Forum|alt.badge.img+5

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

AJPinto
Forum|alt.badge.img+26
  • Legendary Contributor
  • September 12, 2023

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. 


Forum|alt.badge.img+5
  • Author
  • Contributor
  • September 13, 2023

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?