MakeMeAnAdmin
MakeMeAnAdmin copied to clipboard
Issues with script
-
Whenever the LaunchDaemon ('removeAdmin.plist') loads, it errors with code 127. I have been observing it using the LaunchControl GUI tool. It appears to load/run, but then it definitely throws an error.
-
After the workflow is done and the user account is demoted to a standard user again, the ‘removeAdminRights.sh’ script doesn’t delete the LaunchDaemon.
-
The final step in which the script collects logs and saves them to an archive file. This step needs to be moved earlier in the script and the syntax needed to be changed.
Change syntax from: log collect --last 30m --output /private/var/userToRemove/$userToRemove.logarchive
To: log collect --output /private/var/userToRemove/$userToRemove.logarchive --last 30m
(Thanks to Brant Backes on Slack.)
The delete issue you can fix by moving this line;
launchctl unload /Library/LaunchDaemons/removeAdmin.plist
Because the removeAdmin.sh will quit as soon as that command happens so move it 2 lines lower. At least that's what I found.
The delete issue you can fix by moving this line;
launchctl unload /Library/LaunchDaemons/removeAdmin.plist
Because the removeAdmin.sh will quit as soon as that command happens so move it 2 lines lower. At least that's what I found.
Are you saying to run the launchctl unload at the very end? Thats would be 2 lines lower.
Above the "fi" line so it's still in the if condition.