Windows Vista Forums

WMI script to obtain Power Supply information
  1. #1


    Nelson Guest

    WMI script to obtain Power Supply information

    I am writting a server inventory database and using WMI VBScripts to obtain
    the data. So far I have been able to easily get RAM, CPU, Model, etc.
    information using WMI. I am now trying to collect the total number of powers
    supplies in a server. For example a HP DL380 G5 might have 1 or 2 power
    supplies installed in it.

    I cannot find any information (Google, Bing, etc.) regarding how to get this
    information. I found Win32_PowerSupply but Google only yields one hit. When
    I try to use this class, it errors out. Here is a tidbit of the code:

    For Each objItem in objDictionary
    Set objWMIService = GetObject("winmgmts:" &
    "{impersonationLevel=impersonate}!\\" & objDictionary.Item(objItem) &
    "\root\cimv2")
    Set colPowerSupply = objWMIService.ExecQuery("Select * from
    Win32_PowerSupply")
    For Each objPS in colPowerSupply
    objResultsFile.WriteLine(objDictionary.Item(objItem) & "," & objPS.Name)
    Next
    Next

    It basically fails at the "For Each objPS in colPowerSupply" line.

    Anyone have any ideas how to get this information? Is it stored in the
    registry maybe and I can query that instead? Trying to Google this has been
    a nightmare compared to how easy it was to find sample scripts on other
    inventory gathering techniques.



    Thanks
    Nelson

      My System SpecsSystem Spec

  2. #2


    Richard Mueller [MVP] Guest

    Re: WMI script to obtain Power Supply information


    "Nelson" <Nelson@xxxxxx> wrote in message
    news:B0B1E290-4687-4F94-A470-A1F23D03EC84@xxxxxx

    >I am writting a server inventory database and using WMI VBScripts to obtain
    > the data. So far I have been able to easily get RAM, CPU, Model, etc.
    > information using WMI. I am now trying to collect the total number of
    > powers
    > supplies in a server. For example a HP DL380 G5 might have 1 or 2 power
    > supplies installed in it.
    >
    > I cannot find any information (Google, Bing, etc.) regarding how to get
    > this
    > information. I found Win32_PowerSupply but Google only yields one hit.
    > When
    > I try to use this class, it errors out. Here is a tidbit of the code:
    >
    > For Each objItem in objDictionary
    > Set objWMIService = GetObject("winmgmts:" &
    > "{impersonationLevel=impersonate}!\\" & objDictionary.Item(objItem) &
    > "\root\cimv2")
    > Set colPowerSupply = objWMIService.ExecQuery("Select * from
    > Win32_PowerSupply")
    > For Each objPS in colPowerSupply
    > objResultsFile.WriteLine(objDictionary.Item(objItem) & "," & objPS.Name)
    > Next
    > Next
    >
    > It basically fails at the "For Each objPS in colPowerSupply" line.
    >
    > Anyone have any ideas how to get this information? Is it stored in the
    > registry maybe and I can query that instead? Trying to Google this has
    > been
    > a nightmare compared to how easy it was to find sample scripts on other
    > inventory gathering techniques.
    >
    > Thanks
    > Nelson
    I cannot find a machine where the Win32_PowerSupply class is supported.

    --
    Richard Mueller
    MVP Directory Services
    Hilltop Lab - http://www.rlmueller.net
    --



      My System SpecsSystem Spec

  3. #3


    OldDog Guest

    Re: WMI script to obtain Power Supply information

    On Jun 9, 2:34*pm, David Kerber
    <ns_dkerber@xxxxxx_WarrenRogersAssociates.com> wrote:

    > In article <e4ND#eT6JHA.1...@xxxxxx>, rlmueller-
    > nos...@xxxxxx says...
    >
    > ...
    >

    > > > It basically fails at the "For Each objPS in colPowerSupply" line.
    >

    > > > Anyone have any ideas how to get this information? *Is it stored inthe
    > > > registry maybe and I can query that instead? *Trying to Google thishas
    > > > been
    > > > a nightmare compared to how easy it was to find sample scripts on other
    > > > inventory gathering techniques.
    >

    > > > Thanks
    > > > Nelson
    >

    > > I cannot find a machine where the Win32_PowerSupply class is supported.
    >
    > I would be shocked if windows tracked (or could even get) information
    > about power supplies. *If it is available in some machines, it's almost
    > certainly mfr's speciial hardware management software that is providing
    > it.
    >
    > --
    > /~\ The ASCII
    > \ / Ribbon Campaign
    > *X *Against HTML
    > / \ Email!
    >
    > Remove the ns_ from if replying by e-mail (but keep posts in the
    > newsgroups if possible).
    I just ran across something that I found interesting.
    If you use HP/Compaq servers and you have installed the Management
    agents,
    You will find a Name Space called root\HPQ that has 363 classes
    associated with it.

    Basically, every thing the HP Management agents know about the server
    is available.

    This might be of use to you

    OldDog

      My System SpecsSystem Spec

  4. #4


    Nelson Guest

    Re: WMI script to obtain Power Supply information

    Excellent. Thanks to all three of you for taking the time to reply.

    Nelson

    "OldDog" wrote:

    > On Jun 9, 2:34 pm, David Kerber
    > <ns_dkerber@xxxxxx_WarrenRogersAssociates.com> wrote:

    > > In article <e4ND#eT6JHA.1...@xxxxxx>, rlmueller-
    > > nos...@xxxxxx says...
    > >
    > > ...
    > >

    > > > > It basically fails at the "For Each objPS in colPowerSupply" line.
    > >

    > > > > Anyone have any ideas how to get this information? Is it stored in the
    > > > > registry maybe and I can query that instead? Trying to Google this has
    > > > > been
    > > > > a nightmare compared to how easy it was to find sample scripts on other
    > > > > inventory gathering techniques.
    > >

    > > > > Thanks
    > > > > Nelson
    > >

    > > > I cannot find a machine where the Win32_PowerSupply class is supported.
    > >
    > > I would be shocked if windows tracked (or could even get) information
    > > about power supplies. If it is available in some machines, it's almost
    > > certainly mfr's speciial hardware management software that is providing
    > > it.
    > >
    > > --
    > > /~\ The ASCII
    > > \ / Ribbon Campaign
    > > X Against HTML
    > > / \ Email!
    > >
    > > Remove the ns_ from if replying by e-mail (but keep posts in the
    > > newsgroups if possible).
    >
    > I just ran across something that I found interesting.
    > If you use HP/Compaq servers and you have installed the Management
    > agents,
    > You will find a Name Space called root\HPQ that has 363 classes
    > associated with it.
    >
    > Basically, every thing the HP Management agents know about the server
    > is available.
    >
    > This might be of use to you
    >
    > OldDog
    >

      My System SpecsSystem Spec

WMI script to obtain Power Supply information problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
power supply kev s148 General Discussion 9 25 Sep 2009
Power supply help naturalphenomen Software 5 18 Sep 2009
Power Supply Airbot General Discussion 8 26 Nov 2008
Hi & Power Supply Matty79 Chillout Room 5 22 Sep 2008
Power Supply - Request for information rapierau General Discussion 2 22 Aug 2007