Hello everyone. Thanks for sharing valuable insights in our Hexnode Connect.
Yes, @Eugene. You can grant temporary administrative privileges for standard user accounts on macOS Ventura via scripts. You can execute the following script to grant administrative privileges to a standard user account for 45 minutes using Hexnode’s Execute Custom Script feature:
//bin/bash
macname=$(networksetup -getcomputername)
date=$(date +”%d-%m-%y”)
time=$(date +”%r”)
console=$(stat -f “%Su” /dev/console)
echo $console
if groups $console | grep -q -w admin;
then
echo “Is Already admin”;
exit 0 else
echo “Not admin”;
fi
osascript -e ‘display dialog “You now have Administrative Rights. Please do not misuse this privilege” buttons {“OK”} default button 1’
dscl . -append /groups/admin GroupMembership $console
sleep 2700 #sleep set for 45 minutes
sudo dseditgroup -o edit -d $console -t user admin
exit 0
This script only works with the currently logged-in user account. Ensure that the user to be granted administrative privileges is logged-in on the device.
After executing the script, the user will be prompted “You now have administrator rights. Please do not misuse this privilege.” The user must click on the ‘OK’ button to obtain admin privileges for 45 minutes.
Once the specified duration ends, the administrative privileges are revoked.
If you encounter any issues or queries, please feel free to contact us at any time.
Regards,
Goerge
Hexnode UEM