Using Python to check if the application is running as an Administrator

The source below checks if the application is running with administrator privileges. Also, this script works on both Unis and Windows system… well, almost all Windows Systems… it doesnt work on WindowsXP… sorry.  🙁

This code first tries to check it’s running as admin in a Unix system, if that fails, an exception is happens and the script assumes you’re on a Windows System.

The function will return true or false, depending if you’re an admin or not…

Here’s how to use it:


The following two tabs change content below.
Breno RdV
Please allow me to introduce myself...I'm a former psychologist, with almost a decade worth of experience in Human Resources and People Management. Now a developer/software analyst working with PowerBuilder, C#, PowerShell and currently expanding to the world of Python, Xamarin, PHP Angular and (why not?) Unity.



Posted in Dev, Python and tagged , , , .