0
    $temps = Get-CIMInstance MSAcpi_ThermalZoneTemperature -Namespace "root/wmi"
    $temps | Select-Object -Property InstanceName,@{n="TempF";e={(($_.currenttemperature /10 -273.15) *1.8 +32)}}

I cannot seem to select-object -ExpandProperty like usual to get just the TempF result:

    InstanceName            TempF
    ------------            -----
    ACPI\ThermalZone\THM__0 77.09

Just want the 77.09

Bonus points if can display in Celsius :)

2 Answers2

1

If using powershell 3 or above you can call the property by using the member name of the object.

Example:

$temps.TempF Would return your result of 77.09

$tempt = Get-CimInstance MSAcpi_ThermalZoneTemperature -Namespace "root/wmi"
$temps = ($tempt | Select-Object -Property InstanceName,@{n="TempF";e={(($_.currenttemperature /10 -273.15) *1.8 +32)}},@{n="TempC";e={($_.currenttemperature /10 -273.15)}})

I have also added Celcius to the object/variable $temps.

You can get either Fahrenheit $temps.tempF or Celsius $temps.tempC

CraftyB
  • 721
  • 5
  • 11
0
    $tempt = Get-CimInstance MSAcpi_ThermalZoneTemperature -Namespace "root/wmi"
    $tempF = ($tempt | Select-Object -Property InstanceName,@{n="TempF";e={(($_.currenttemperature /10 -273.15) *1.8 +32)}})|Select-Object -ExpandProperty TempF

Had an epiphany and figured it out.