Windows Powershell udsender nogle gange ingen værdier (temperatursensor)

Indlæg af Hanne Mølgaard Plasc

Problem



Fra tid til anden sker det, at der ikke vises temperaturføler. Jeg bruger Powershell til at læse værdierne og det virker ofte. Jeg vil gerne vide, hvorfor Windows nogle gange ikke returnerer noget. Er det på min bærbare computer, software eller hvad?


powershell Get-WmiObject -Class Win32\_PerfFormattedData\_Counters\_ThermalZoneInformation |Select-Object Name,Temperature

Bedste reference


Den aktuelle klasse er MSAcpi\_ThermalZoneTemperature . Brug nedenstående funktion:


function Get-Temperature {
    $t = Get-WmiObject MSAcpi\_ThermalZoneTemperature -Namespace "root/wmi"
    $currentTempKelvin = $t.CurrentTemperature / 10
    $currentTempCelsius = $currentTempKelvin - 273.15
    $currentTempFahrenheit = (9/5) * $currentTempCelsius + 32
    return $currentTempCelsius.ToString() + " C : " + $currentTempFahrenheit.ToString() + " F : " + $currentTempKelvin + "K" 
}


Alternativ:


$strComputer = "."

$objWMi = get-wmiobject -namespace rootWMI -computername localhost -Query "Select * from MSAcpi\_ThermalZoneTemperature"

foreach ($obj in $objWmi)
{
    write-host "Active:" $obj.Active
    write-host "ActiveTripPoint:" $obj.ActiveTripPoint
    write-host "ActiveTripPointCount:" $obj.ActiveTripPointCount
    write-host "CriticalTripPoint:" $obj.CriticalTripPoint
    write-host "CurrentTemperature:" $obj.CurrentTemperature
    write-host "InstanceName:" $obj.InstanceName
    write-host "PassiveTripPoint:" $obj.PassiveTripPoint
    write-host "Reserved:" $obj.Reserved
    write-host "SamplingPeriod:" $obj.SamplingPeriod
    write-host "ThermalConstant1:" $obj.ThermalConstant1
    write-host "ThermalConstant2:" $obj.ThermalConstant2
    write-host "ThermalStamp:" $obj.ThermalStamp
    write-host
    write-host "########"
    write-host
}


Referencelink: Termisk zoneinfo [4]


Håber det hjælper.