I've been tasked to check whether the user of a script has administrative privileges (as they are needed to run certain parts of the script), and if not notify the user to run the script with admin privileges.
Since the script is to be widely distributed, controlling the file rights will not be sufficient.
Any ideas on how to script this check?
Note: I have a couple ideas, but I don't want this to be a hack.
Hard-coding a particular check which is not relevant for the privileges actually required for the script to work sounds like an annoying feature. Can you check for ability to manipulate those resources which the script will actually need to manipulate? Then it's easier to plonk in to alternate access control systems.