Error dividing variable

Hello, I am trying to divide a variable I stored. I am trying to get the cpu temp, and convert it so it is human readable. I am using this like to get the temp.

$temp = get-wmiobject MSAcpi_ThermalZoneTemperature -namespace "root/wmi" | Select-Object CurrentTemperature;

I am able to verify it stores it by echoing back $temp.

Next I try to convert it with

$tempCelc = $temp /10 - 273.15;

When I do this I get an error. “Method invocation failed because [System.Management.Automation.PSObject] does not contain a method named ‘op_Division’.”

If anyone knows how to fix this please let me know. Thank you.

Welcome to the forum. :wave:t4:

You should not use Get-WmiObject anymore. Use

instead. :+1:t4:

You’re trying to calculate with the object - not with its property (value). :wink:

$ThermalZoneTemperature = 
    Get-CimInstance -ClassName MSAcpi_ThermalZoneTemperature -Namespace 'root/wmi'
$tempCelc = 
    $ThermalZoneTemperature.CurrentTemperature / 10 - 273.15