Hello,

I want to write a utility which allow me to read the CPU temperature. My
notebook is an old ThinkPad 600X (PIII 650 MHz) and is ACPI compliant.

I use WMI and the class MSAcpi_ThermalZoneTemperature . Please see my VBS:

strComputer = "."
wmiNS = "\root\wmi"
wmiQuery = "Select * from MSAcpi_ThermalZoneTemperature"

Set objLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objLocator.ConnectServer(strComputer, wmiNS)
Set colItems = objWMIService.ExecQuery(wmiQuery)
For Each objItem in colItems
With objItem
wscript.echo "CurrentTemperature: " & .CurrentTemperature
wscript.echo "InstanceName: " & .InstanceName
wscript.echo " "
End With
Next

It works but it does not refresh the temperature. I get always the same
temperature. Only after Reboot I get other values.

Is there a way to force WMI to refresh the ACPI data?

Thanks for your help!

Harald

Re: How refresh the ACPI thermal zone temperature? by VanguardLH

VanguardLH
Thu May 08 02:11:06 PDT 2008

"Harald" wrote in
<news:B250BED5-E2FA-45A0-908B-A8B32090E042@microsoft.com>:

> Hello,
>
> I want to write a utility which allow me to read the CPU temperature. My
> notebook is an old ThinkPad 600X (PIII 650 MHz) and is ACPI compliant.
>
> I use WMI and the class MSAcpi_ThermalZoneTemperature . Please see my VBS:
>
> strComputer = "."
> wmiNS = "\root\wmi"
> wmiQuery = "Select * from MSAcpi_ThermalZoneTemperature"
>
> Set objLocator = CreateObject("WbemScripting.SWbemLocator")
> Set objWMIService = objLocator.ConnectServer(strComputer, wmiNS)
> Set colItems = objWMIService.ExecQuery(wmiQuery)
> For Each objItem in colItems
> With objItem
> wscript.echo "CurrentTemperature: " & .CurrentTemperature
> wscript.echo "InstanceName: " & .InstanceName
> wscript.echo " "
> End With
> Next
>
> It works but it does not refresh the temperature. I get always the same
> temperature. Only after Reboot I get other values.
>
> Is there a way to force WMI to refresh the ACPI data?
>
> Thanks for your help!
>
> Harald

Guess I missed the part of the name of this newsgroup that says it deals
with programming issues.

See: microsoft.public.vb.*

Where is the refresh method, like on the whatever panel uses this code?
How about the DoEvents on the app? I'm sure the VB newsgroups can
answer how to refresh your panel and when to do so but you might want to
provide more context than this code snippet.

Re: How refresh the ACPI thermal zone temperature? by Harald

Harald
Thu May 08 04:40:00 PDT 2008

Hello,

it does not work with the Refresh method and the DoEvents. It is much more
complex. I searched in the web for hours, and I find only people with the
same problem, but no ansers.

Maybe I post the question also in the developer forum.

Thanks

Harald


"VanguardLH" wrote:

> "Harald" wrote in
> <news:B250BED5-E2FA-45A0-908B-A8B32090E042@microsoft.com>:
>
> > Hello,
> >
> > I want to write a utility which allow me to read the CPU temperature. My
> > notebook is an old ThinkPad 600X (PIII 650 MHz) and is ACPI compliant.
> >
> > I use WMI and the class MSAcpi_ThermalZoneTemperature . Please see my VBS:
> >
> > strComputer = "."
> > wmiNS = "\root\wmi"
> > wmiQuery = "Select * from MSAcpi_ThermalZoneTemperature"
> >
> > Set objLocator = CreateObject("WbemScripting.SWbemLocator")
> > Set objWMIService = objLocator.ConnectServer(strComputer, wmiNS)
> > Set colItems = objWMIService.ExecQuery(wmiQuery)
> > For Each objItem in colItems
> > With objItem
> > wscript.echo "CurrentTemperature: " & .CurrentTemperature
> > wscript.echo "InstanceName: " & .InstanceName
> > wscript.echo " "
> > End With
> > Next
> >
> > It works but it does not refresh the temperature. I get always the same
> > temperature. Only after Reboot I get other values.
> >
> > Is there a way to force WMI to refresh the ACPI data?
> >
> > Thanks for your help!
> >
> > Harald
>
> Guess I missed the part of the name of this newsgroup that says it deals
> with programming issues.
>
> See: microsoft.public.vb.*
>
> Where is the refresh method, like on the whatever panel uses this code?
> How about the DoEvents on the app? I'm sure the VB newsgroups can
> answer how to refresh your panel and when to do so but you might want to
> provide more context than this code snippet.
>