get cpu temperature without elevated privileges

113 Views Asked by At

In windows 7 or in windows 11 i want to display the cpu temperature using a python script.

The code i run successfully is:

import wmi
import pyuac

def main():
    w = wmi.WMI(namespace='root\\wmi')
    temperature = w.MSAcpi_ThermalZoneTemperature()[0]
    temperature = int(temperature.CurrentTemperature / 10.0 - 273.15)
    print(str(temperature)+"°C")
    input("Press any key to exit...")

if __name__ == "__main__":
    if not pyuac.isUserAdmin():
        print("Re-launching as admin!")
        pyuac.runAsAdmin()
    else:        
        main()  # Already an admin here.

The main problem with the above script is that it must be admin user to run it. Is there any other similar script i can use with no admin privileges required?

0

There are 0 best solutions below