locked
Why this script does not work on XP or Vista RRS feed

  • Question

  • Does somebody know why this code does not work ?

    [code]

    strServer = "."

    Set objWMI = GetObject("winmgmts://" & strServer & "/root\WMI")
    Set objInstances = objWMI.InstancesOf("MSAcpi_ThermalZoneTemperature",48)

    For Each objInstance in objInstances            ' <== this break
       WScript.Echo objInstance.getObjectText_
    Next


    [/code]

    I get next error :

    Microsoft (R) Windows Script Host Version 5.7
    Copyright (C) Microsoft Corporation. All rights reserved.
    C:\vb.vbs(6, 1) (null): 0x8004100C

    If can some one can help me please!!!
    Thank you
    Wednesday, December 31, 2008 1:46 PM

Answers

  • Try this:

    Dim strServer = "."
    Dim objWMI = GetObject("winmgmts://" & strServer & "/root\WMI")
    Dim objInstances = objWMI.InstancesOf("MSAcpi_ThermalZoneTemperature", 48)

    For Each objInstances In objInstances
        
    System.Console.WriteLine(objInstances.getObjectText)
    Next


    Analyst
    • Marked as answer by Xingwei Hu Wednesday, January 7, 2009 5:36 AM
    Tuesday, January 6, 2009 8:47 PM

All replies

  • Your best bet is to ask in a VBS forum; this is for .NET framework VB questions. See the sticky posts at the top of the forum. Thanks.
    Stephen J Whiteley
    Wednesday, December 31, 2008 1:55 PM
    Moderator
  • Try this:

    Dim strServer = "."
    Dim objWMI = GetObject("winmgmts://" & strServer & "/root\WMI")
    Dim objInstances = objWMI.InstancesOf("MSAcpi_ThermalZoneTemperature", 48)

    For Each objInstances In objInstances
        
    System.Console.WriteLine(objInstances.getObjectText)
    Next


    Analyst
    • Marked as answer by Xingwei Hu Wednesday, January 7, 2009 5:36 AM
    Tuesday, January 6, 2009 8:47 PM