2016-09-28 6 views
1

내 컴퓨터에서 CPU 온도를 얻으려고합니다. 에 StackOverflow에 검색 나는이 발견CMD/POWER 쉘에서 CPU 온도 얻기

C:\WINDOWS\system32>wmic /namespace:\\root\wmi PATH MSAcpi_ThermalZoneTemperature get CurrentTemperature 

을하지만이 오류 얻을 :

Node - ADMIN 
ERROR: 
Description = Not supported 
+1

는 "지원되지 않음"센서에서 직렬화 된 객체를 사용하는 XML 잎 임계 온도와 (섭씨) 비율을 보여줍니다 . BIOS는 읽기 만 지원하지 않습니다. –

답변

2

는이 코드를 사용할 수 있습니다

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 
1

당신은 모두 WMI에서 CPU 온도를 얻을 수 및 Openhardwaremonitor 방식.

열기 Hardwaremonitor :

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using OpenHardwareMonitor.Hardware; 
namespace Get_CPU_Temp5 
{ 
    class Program 
    { 
     public class UpdateVisitor : IVisitor 
     { 
      public void VisitComputer(IComputer computer) 
      { 
       computer.Traverse(this); 
      } 
      public void VisitHardware(IHardware hardware) 
      { 
       hardware.Update(); 
       foreach (IHardware subHardware in hardware.SubHardware) subHardware.Accept(this); 
      } 
      public void VisitSensor(ISensor sensor) { } 
      public void VisitParameter(IParameter parameter) { } 
     } 
     static void GetSystemInfo() 
     { 
      UpdateVisitor updateVisitor = new UpdateVisitor(); 
      Computer computer = new Computer(); 
      computer.Open(); 
      computer.CPUEnabled = true; 
      computer.Accept(updateVisitor); 
      for (int i = 0; i < computer.Hardware.Length; i++) 
      { 
       if (computer.Hardware[i].HardwareType == HardwareType.CPU) 
       { 
        for (int j = 0; j < computer.Hardware[i].Sensors.Length; j++) 
        { 
         if (computer.Hardware[i].Sensors[j].SensorType == SensorType.Temperature) 
           Console.WriteLine(computer.Hardware[i].Sensors[j].Name + ":" + computer.Hardware[i].Sensors[j].Value.ToString() + "\r"); 
        } 
       } 
      } 
      computer.Close(); 
     } 
     static void Main(string[] args) 
     { 
      while (true) 
      { 
       GetSystemInfo(); 
      } 
     } 
    } 
} 

WMI는 :

using System; 
using System.Diagnostics; 
using System.Management; 
class Program 
{ 
    static void Main(string[] args) 
    { 
     Double CPUtprt = 0; 
     System.Management.ManagementObjectSearcher mos = new System.Management.ManagementObjectSearcher(@"root\WMI", "Select * From MSAcpi_ThermalZoneTemperature"); 
     foreach (System.Management.ManagementObject mo in mos.Get()) 
     { 
      CPUtprt = Convert.ToDouble(Convert.ToDouble(mo.GetPropertyValue("CurrentTemperature").ToString()) - 2732)/10; 
      Console.WriteLine("CPU temp : " + CPUtprt.ToString() + " °C"); 
     } 
    } 
} 

나는 여기에 좋은 튜토리얼, 나는 성공적으로 CPU의 온도를 얻을 발견했다. 새로운 센서로, 또는 내 자녀로 및 고도와

http://www.lattepanda.com/topic-f11t3004.html

0

. 이 시스템에서 작동합니다 아무것도 - 또한 쉽게 디버깅을위한 파일 Temperatures.txt 및

function Get-Temperature { 
    $TempFormat = "#" 
    $TempFile = "temperature" 

    $Command = 'Get-WmiObject MSAcpi_ThermalZoneTemperature -Namespace "root/wmi" ' + " > $pwd\$TempFile.txt" 
    $Command = 'Get-WmiObject MSAcpi_ThermalZoneTemperature -Namespace "root/wmi" ' + " | Export-Clixml $pwd\$TempFile.xml" 

    $p = Start-Process -Verb runas -FilePath "powershell" -ArgumentList $command -WorkingDirectory $pwd -PassThru 
    $p.WaitForExit() 

    $t = Import-Clixml pippo.xml 

    $returntemp = @() 

    foreach ($Sensor in $t) 
    { 
    $Active = if($sensor.Active){"On "}else{"Off"} 
    $temp = $Sensor.CurrentTemperature 
    $Critical = $Sensor.CriticalTripPoint 

    $currentTempKelvin = $temp/10 
    $currentTempCelsius = $currentTempKelvin - 273.15 
    $currentTempFahrenheit = (9/5) * $currentTempCelsius + 32 

    $StrKelvin = $currentTempKelvin.ToString($TempFormat).PadLeft(3, " ") 
    $StrCelsius = $currentTempCelsius.ToString($TempFormat).PadLeft(3, " ") 
    $StrFahrenheit = $currentTempFahrenheit.ToString($TempFormat).PadLeft(3, " ") 

    $CriticalKelvin = $Critical/10 
    $CriticalCelsius = $CriticalKelvin - 273.15 
    $CriticalFahrenheit = (9/5) * $CriticalCelsius + 32 

    $StrCritKelvin = $CriticalKelvin.ToString($TempFormat).PadRight(3, " ") 
    $StrCritCelsius = $CriticalCelsius.ToString($TempFormat).PadRight(3, " ") 
    $StrCritFahrenheit = $CriticalFahrenheit.ToString($TempFormat).PadRight(3, " ") 

    $PerCrit = ($currentTempCelsius/$CriticalCelsius * 100) 
    $StrPerCrit = $PerCrit.ToString($TempFormat).PadLeft(3, " ") 

    $returntemp += "$Active $StrPerCrit% $StrCelsius/$StrCritCelsius C : $StrFahrenheit/$StrCritFahrenheit F : $StrKelvin/$StrCritKelvin K - " + $Sensor.InstanceName 
    } 
    return $returntemp 
} 

Get-Temperature