1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137:
| program CPUTemp;
{$APPTYPE CONSOLE}
uses SysUtils, Dialogs, ActiveX, Variants, WbemScripting_TLB;
procedure ShowTemperatureInfo(); var WMIServices: ISWbemServices; Root : ISWbemObjectSet; Item : Variant; I : Integer; begin
Writeln('Temperature Info'); Writeln('----------------');
WMIServices := CoSWbemLocator.Create.ConnectServer('.', 'root\cimv2','', '', '', '', 0, nil); Root := WMIServices.ExecQuery('Select * FROM Win32_TemperatureProbe','WQL', 0, nil);
for I := 0 to Root.Count - 1 do begin Item := Root.ItemIndex(I); Writeln('Accuracy '+VarToStr(Item.Accuracy)); Writeln('Availability '+VarToStr(Item.Availability)); Writeln('Caption '+Item.Caption); Writeln('Config Manager Error Code '+VarToStr(Item.ConfigManagerErrorCode)); Writeln('Config Manager User Config '+VarToStr(Item.ConfigManagerUserConfig)); Writeln('Creation Class Name '+VarToStr(Item.CreationClassName)); Writeln('Current Reading '+VarToStr(Item.CurrentReading)); Writeln('Description '+VarToStr(Item.Description)); Writeln('Device ID '+VarToStr(Item.DeviceID)); Writeln('Error Cleared '+VarToStr(Item.ErrorCleared )); Writeln('Error Description '+VarToStr(Item.ErrorDescription)); Writeln('Install Date '+VarToStr(Item.InstallDate)); Writeln('Is Linear '+VarToStr(Item.IsLinear)); Writeln('Last Error Code '+VarToStr(Item.LastErrorCode)); Writeln('Lower Threshold Critical '+VarToStr(Item.LowerThresholdCritical)); Writeln('Lower Threshold Fatal '+VarToStr(Item.LowerThresholdFatal)); Writeln('Lower Threshold NonCritical '+VarToStr(Item.LowerThresholdNonCritical)); Writeln('Max Readable '+VarToStr(Item.MaxReadable)); Writeln('Min Readable '+VarToStr(Item.MinReadable)); Writeln('Name '+VarToStr(Item.Name)); Writeln('Nominal Reading '+VarToStr(Item.NominalReading)); Writeln('Normal Max '+VarToStr(Item.NormalMax)); Writeln('Normal Min '+VarToStr(Item.NormalMin )); Writeln('PNP Device ID '+VarToStr(Item.PNPDeviceID)); Writeln('Power Management Capabilities '+VarToStr(Item.PowerManagementCapabilities)); Writeln('Power Management Supported '+VarToStr(Item.PowerManagementSupported)); Writeln('Resolution '+VarToStr(Item.Resolution)); Writeln('Status '+VarToStr(Item.Status)); Writeln('Status Info '+VarToStr(Item.StatusInfo)); Writeln('System Creation Class Name '+VarToStr(Item.SystemCreationClassName)); Writeln('System Name '+VarToStr(Item.SystemName)); Writeln('Tolerance '+VarToStr(Item.Tolerance)); Writeln('Upper Threshold Critical '+VarToStr(Item.UpperThresholdCritical)); Writeln('Upper Threshold Fatal '+VarToStr(Item.UpperThresholdFatal)); Writeln('Upper Threshold NonCritical '+VarToStr(Item.UpperThresholdNonCritical)); Writeln(''); end; end;
procedure ShowCPUFanInfo(); var WMIServices: ISWbemServices; Root : ISWbemObjectSet; Item : Variant; I : Integer; begin Writeln('CPU FAN Info'); Writeln('----------------'); WMIServices := CoSWbemLocator.Create.ConnectServer('.', 'root\cimv2','', '', '', '', 0, nil); Root := WMIServices.ExecQuery('Select * FROM Win32_Fan','WQL', 0, nil); for I := 0 to Root.Count - 1 do begin Item := Root.ItemIndex(I);
Writeln('ActiveCooling '+VarToStr(Item.ActiveCooling)); Writeln('Availability '+VarToStr(Item.Availability)); Writeln('Caption '+VarToStr(Item.Caption)); Writeln('Config Manager ErrorCode '+VarToStr(Item.ConfigManagerErrorCode)); Writeln('Config Manager UserConfig '+VarToStr(Item.ConfigManagerUserConfig)); Writeln('Creation ClassName '+VarToStr(Item.CreationClassName)); Writeln('Description '+VarToStr(Item.Description)); Writeln('DesiredSpeed '+VarToStr(Item.DesiredSpeed)); Writeln('DeviceID '+VarToStr(Item.DeviceID)); Writeln('ErrorCleared '+VarToStr(Item.ErrorCleared)); Writeln('ErrorDescription '+VarToStr(Item.ErrorDescription)); Writeln('InstallDate '+VarToStr(Item.InstallDate)); Writeln('LastErrorCode '+VarToStr(Item.LastErrorCode)); Writeln('Name '+VarToStr(Item.Name)); Writeln('PNPDeviceID '+VarToStr(Item.PNPDeviceID)); Writeln('PowerManagement Capabilities '+VarToStr(Item.PowerManagementCapabilities)); Writeln('PowerManagement Supported '+VarToStr(Item.PowerManagementSupported)); Writeln('Status '+VarToStr(Item.Status)); Writeln('StatusInfo '+VarToStr(Item.StatusInfo)); Writeln('SystemCreation ClassName '+VarToStr(Item.SystemCreationClassName)); Writeln('SystemName '+VarToStr(Item.SystemName)); Writeln('VariableSpeed '+VarToStr(Item.VariableSpeed)); Writeln(''); end;
End;
begin try CoInitialize(nil); ShowTemperatureInfo(); ShowCPUFanInfo(); Readln; CoUninitialize; except on E:Exception do Begin CoUninitialize; Writeln(E.Classname, ': ', E.Message); Readln; End; end; end. |