# CPU temperature in windows

**URL:** <https://forum.inductiveautomation.com/t/cpu-temperature-in-windows/54938>\
**Category:** Ignition\
**Tags:** python\
**Created:** [January 12, 2022, 5:00pm UTC](https://forum.inductiveautomation.com/t/cpu-temperature-in-windows/54938 "2022-01-12T17:00:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![edoardo.manzardo](https://avatars.discourse-cdn.com/v4/letter/e/c89c15/32.png) [@edoardo.manzardo](https://forum.inductiveautomation.com/u/edoardo.manzardo)\
**Post date:** [January 12, 2022, 5:00pm UTC](https://forum.inductiveautomation.com/t/cpu-temperature-in-windows/54938/1 "2022-01-12T17:00:06Z")

</div>

Hi,  
I want to read the CPU temperature of my PC that it have windows 10 installed inside.  
How can do this by a python script?

Is possible?  
I have find this library “psutil” but it do not work.

---

<div class="post-metadata">

**Author:** ![djs](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@djs](https://forum.inductiveautomation.com/u/djs)\
**Post date:** [January 14, 2022, 5:55pm UTC](https://forum.inductiveautomation.com/t/cpu-temperature-in-windows/54938/2 "2022-01-14T17:55:45Z")

</div>

You could perhaps use SNMP?

Someone made a simple module for free that you might be able to use:

> [@SNMP function for Ignition version 8](https://forum.inductiveautomation.com/t/snmp-function-for-ignition-version-8/35167):
>
> Hi all. [Here](https://github.com/gitRaiku/Snmp-Ignition-Module) you have a simple SNMP function tested with v1/v2c devices under V8 As of now the only operation available is snmp Get and can be called by using system.snmp.snmpGet(‘community’, ‘address’, port, ‘OID’) Returns value as string I was in need of a simple function for SNMP. The driver on market seems a little complicated and the free one made by BYES for V7.9 is not free anymore for V8 ( for a good reason ) So I asked my son for help, we took the function example, tweaked the cod…

You could also use:  
[Kymera Systems Inc | IIoT Solutions - Kymera SNMP Driver](https://www.kymerasystems.com/kymera-snmp-driver/) , but that one is not free.

You might have to do a bit of research to find the right OID etc. This post could be a good start:

> <https://stackoverflow.com/questions/36594449/how-to-monitor-windows-cpu-and-fan-temperature-by-snmp-or-other-ways>

Another technique could be to run a batch file with system.util.execute(). This post might be a good start:

> <https://superuser.com/questions/1241303/how-to-get-cpu-temperature-on-windows-system-using-both-snmp-and-cmd>

---

<div class="post-metadata">

**Author:** ![SKA](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ska/32/29528_2.png) [@SKA](https://forum.inductiveautomation.com/u/SKA)\
**Post date:** [January 17, 2022, 3:09pm UTC](https://forum.inductiveautomation.com/t/cpu-temperature-in-windows/54938/3 "2022-01-17T15:09:02Z")

</div>

You can use this power shell function, but it has to be run with admin privileges, which i think ignition do have

```auto
function Get-Temperature {
    $t = Get-WmiObject MSAcpi_ThermalZoneTemperature -Namespace "root/wmi"
    $returntemp = @()

    foreach ($temp in $t.CurrentTemperature)
    {

    $currentTempKelvin = $temp / 10
    $currentTempCelsius = $currentTempKelvin - 273.15

    $currentTempFahrenheit = (9/5) * $currentTempCelsius + 32

    $returntemp += $currentTempCelsius.ToString() + " C : " + $currentTempFahrenheit.ToString() + " F : " + $currentTempKelvin + "K"  
    }
    return $returntemp
}

Get-Temperature

```
