HP BladeSystem PowerShell cmdlets

January 6, 2011

21 comments

In the last few days I was working with Artur Zurawicz (this guy rocks!), Microsoft OpsMgr PFE, on our OpsMgr server. We had a discussion regarding PowerShell and while we were working with the shell I executed the Get-PSSnapin cmdlet and was very intrigued by the output:

 

For quite some time I have been searching for PowerShell cmdlets for HP blades and couldn’t find one , and there it was, right here under my nose! I knew we had the HP BladeSystem Management pack installed but never knew it uses PowerShell scripts to monitor the health of blade enclosures. I searched the web for the snap-in name and found this document (PDF). 

Feeling lucky, as if I have just found Ali Baba’s secret treasure, I quickly executed another command to list the cmdlets of the HewlettPackard.Servers.BladeSystem.HPBladeSystemEnclosureCmdLets snap-in:

 

 

How do I install the cmdlets on my machine? I don’t want to connect to my OpsMgr server to use the cmdlets. I decided to install the HP BladeSystem Management Pack on my admin machine (Windows 7 x64) and see how it goes. I grabbed the installation files from our server and ran the setup file. After installing the package locally I was able to use the cmdlets. Here’s a detailed step by step procedure to install the package on Windows 7.

 

The HP BladeSystem Management Pack kit can be downloaded from the HP Web site (15.7 MB, needs registration). Download the file and extract it. The folder contains the following files:

•  HPBladeSystemMP01_40(x64).exe
•  HPBladeSystemMP01_40(X86).exe
•  HPBladeSystemMPLicense.rtf
•  HPBladeSystemMPReleaseNotes.rtf
•  HPBladeSystemMPTroubleshootingAssistant.chm
•  HPBladeSystemMPUserGuide.chm

Note: The HP BladeSystem Management Pack used in this post is version 1.4 (2010). At work we use a “newer” version (1.6 October 2009), I’m not sure why the “new” version is older than the current one that HP provides, I also couldn’t find a download link either. Anyway, the procedure described below is the same for both versions. 

Run the setup file (as administrator, I used the HPBladeSystemMP01_40(x64).exe version)

 

The installer detected that the local machine is not an OpsMgr server and removed the Managament Pack from the installation. Additional components include documentation, the enclosure monitor service and the enclosure monitor manager. The Monitor Service runs on the system to monitor HP BladeSystem c-Class enclosures. The Monitor Service also requires the SNMP Trap service as the monitoring service (HPBladeSystemEnclosureMonitorService) depends on it.

 

At this stage all selected components are installed and we need to register the enclosures we want to monitor. Click ‘Finish’ to launch the HP BladeSystem monitor manager.

 

 

Click the ‘localhost monitor service’ node and then click the ‘Add’ button

 

Click ‘Next’ to add BladeSystem enclosures that you want to manage. Only blade systems from the enclosures you add will be available. Fill in the Name/IP and the credentials of the enclosure and then click ‘Apply’.

 

 

If you have more than one enclosure to add, click ‘Add Another’. This will save the credentials you used previously and you’ll only need to fill in the new enclosure Name/IP.

 

When done, click ‘Next’ for all other screens and then click ‘Finish’. It can take some time for the configuration to update and show on screen. If this takes to long, click the ‘Refresh’ button.

 

You can view the enclosure’s details by clicking on the respective node. You can now close the ‘HP BladeSystem Enclosure Monitor Manager’ interface and proceed to the fun part with PowerShell. Before we do that restart the HPBladeSystemEnclosureMonitorService service to ensure all configurations are in place.

PS > Restart-Service HPBladeSystemEnclosureMonitorService

If you need to make configuration changes, open the ‘HP BladeSystem Enclosure Monitor Manager’ as an administrator, otherwise you’ll get an error (‘Error connecting to localhost.Requested registry access is not allowed’). The Enclosure Monitor Manager can be launched from the command line (bypasses the Connect dialog):

PS > & ‘D:\Program Files\HP BladeSystem Management Pack for Operations Manager 2007\Tools\HPBladeSystemEnclosureMonitorManager.exe’ localhost

 

Open PowerShell, load the HP BladeSystem snap-in and execute the Get-Blade cmdlet, the following example grabs the first blade object:

ps__0001_Layer-1_thumb3

 

Take some time to explore all other cmdlets. Hopefully HP will take it one step further and release a separate PowerShell package aimed towards admins. There’s a lot to improve in the current snap-in. Most of the cmdlets use the Get verb (which are great to produce reports about your blades and enclosures) but some do not conform to the verb naming rules and uses unapproved verbs, such as: Acquire,Apply and Release (more information about verb naming can be found HERE and HERE). We can also use the Get-Verb function to retrieve the list of approved verbs.

That said, it’s a start, HP made the move towards PowerShell and that’s a good thing. Thumbs up!

Lastly, here is a great a tip I got from Artur. The HP HewlettPackard management pack is a sealed pack and therefore we cannot export it using the OpsMgr console directly. However, we can do that using the OpsMgr PowerShell cmdlets. The example below reveals the scripts used by the management pack. At run time these scripts are saved to the OpsMgr agent folder cache and executed from there. The following example shows the code used in one of the scripts.

The commands in the example was executed on the OpsMgr server which has the 1.6 management pack so the structure of the xml file may vary.

PS > Get-ManagementPack -Name HewlettPackard.Servers.BladeSystem | Export-ManagementPack -Path C:\
PS > $xml = Get-Content C:\HewlettPackard.Servers.BladeSystem.xml
$xml.ManagementPack.TypeDefinitions.ModuleTypes.DataSourceModuleType[0].ModuleImplementation.Composite.MemberModules.DataSource.Files.File | Format-List *

 

Enjoy!

Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*

21 comments

  1. Jacques WillemenJanuary 8, 2011 ב 22:50

    Hey there Shay,
    That is really great! Me too, have been searching for a long time for something like this. Guys in the computer room keep changing network connections and we the admins can’t find the right ILO addresses when we really need them. But that will be over from now!
    Wonder why HP kept so silent about these cmdlets. OK they are not in a form to be extremely proud of, but they were Powershelling a few years ago already and did not tell us….why?
    I have tried to turn the snapin into a (xcopy distributable) module, no big success; I guess there are a number of dll’s we do not see, the cmdlets cannot really work if isolated from the OpsMgr Pack. But no worries, give them some more time.
    Have fun! (Mazzeltov)

    Jacques

    Reply
  2. ScriptFanaticJanuary 9, 2011 ב 10:08

    Hey Jacques

    Copying the main snap-in DLL and trying to register it on my machine was my first attempt. I got an error about DLL dependencies and eventually I decided to install the pack instead of hacking the snap-in, which proved to be the right decision.

    Cheers!

    Reply
  3. Cy WebitJune 14, 2011 ב 15:25

    Awesome! Thanks

    Reply
  4. Billy WestburyJune 22, 2011 ב 12:13

    Before I could see the snapin when I ran,
    Get-PSSnapin -Registered,
    I had to run,
    & “C:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe” “C:\Program Files\HP BladeSystem Management Pack for Operations Manager 2007\Monitor Service\HewlettPackard.Servers.BladeSystem.HPBladeSystemEnclosureCmdLets.dll”

    Then I could run
    Add-PSSnapin HewlettPackard.Servers.BladeSystem.HPBladeSystemEnclosureCmdLets

    Hope this help’s.

    Billy

    Reply
  5. ScriptFanaticJune 22, 2011 ב 12:33

    @Billy

    The installer didn’t register the snap-in for you?

    Reply
  6. Cy WebitAugust 10, 2011 ב 18:57

    Jeff, ran your Enclosure Script and it captures most everything I need except System RAM. Did you try to extract that info? Is it possible? It’s in the OA gui.
    Thanks

    Reply
  7. NicolasSeptember 2, 2011 ב 12:17

    Hey, thanks for the script!
    I would like to know how to list the “properties” you can reached from the an object.

    More precisely, how did you know that they were Count,Type and Speed object in Cpus one.
    $BladeData.BladeCPUCount = $blade.Cpus.Count
    $BladeData.BladeCPUModel = $blade.Cpus[1].Type
    $BladeData.BladeCPUSpeed = $blade.Cpus[1].Speed

    I’ve tried several powershell commands but nones give me the expected result.

    In fact,I want to get the Ambient Temperature from BladeThermal, but I don’t know how to list its different properties to check if it’s possible..

    Regards

    Reply
  8. ScriptFanaticSeptember 4, 2011 ב 10:07

    PS > $b = Get-Blade

    pipe $b to Get-Member to get a list of objects members, one of them is BladeThermal which is an object on its own that has many properties:

    # get the first blade, BladeThermal property
    PS > $b[0].BladeThermal

    SensorNumber : 13
    SensorType : 1
    EntityId : 39
    EntityInstance : 1
    CriticalThreshold : 43
    CautionThreshold : 38
    TemperatureC : 17
    Oem : 0
    Description : Ambient Zone

    To get the value of the TemperatureC:

    PS > $b[0].BladeThermal.TemperatureC
    17

    Reply
  9. NicolasSeptember 8, 2011 ב 17:19

    Thanks a lot ! It really helped me

    Reply
  10. SaravananMay 23, 2012 ב 01:12

    Hello,

    Sorry to post in a old blog.
    But this is most informative blog on the internet about HP chassis w/ Powershell.

    I have a question.

    Is there a way to tell if the blade is full or half size blade?

    I want to automate to report on used and empty bays.
    I need this info to find remaining slots.

    If there is no way to tell blade type, other way is find the model and calculate the slots somehow.

    Thanks in advance.

    Reply
  11. ScriptFanaticMay 23, 2012 ב 13:21

    Hi Saravanan

    I don’t have half blade blades so I can’t tell for sure, I would get the info for a full blade and check if the properties holds the information.
    As for empty bays, I think you can query the Presence property in the results of Get-Blade, and the BladeType property for blade type.

    Reply
  12. PriteshDecember 4, 2012 ב 11:44

    Could you please help me using the get-power and get-powersupply cmdlets. Can not seem to get them to pull any information. Thanks.

    Reply
  13. ScriptFanaticDecember 5, 2012 ב 02:59

    @Pritesh, what do you get when you just execute the commands? This is a sample output of what I’m getting:

    PS> Get-Power

    Capacity : 6750
    GoodPowerSupplies : 6
    InputPower : 1854.335
    InputPowerCapacity : 8208
    InputPowerCapacitySpecified : True
    InputPowerCapacityVa : 8208
    InputPowerSpecified : True
    InputPowerVa : 1854.335
    NeededPowerSupplies : 2
    OperationalStatus : OK
    HealthState : Success
    OutputPower : 11890
    PowerConsumed : 4050
    Redundancy : REDUNDANT
    EnclosurePowerMode : AC Redundant
    RedundantCapacity : 2700
    SubsystemType : Internal DC
    WantedPowerSupplies : 4
    EnclosureSerialNumber : XXXXXXXXX
    (…)

    PS> Get-PowerSupply

    Name : BladeSystem c-Class power supply
    BayNumber : 6
    ActualOutput : 0
    Capacity : 2250
    ModelNumber : 412138-B21
    SerialNumber : XXXXXXXXX
    SparePartNumber : 111111-111
    InputOperationalStatus : OK
    InputHealthState : Success
    OperationalStatus : OK
    HealthState : Success
    Presence : Present
    EnclosureSerialNumber : XXXXXXXXX
    Diagnostics : {Device Identification Data, Device Operational, AC Cord}
    (…)

    Reply
  14. ColwellJanuary 25, 2013 ב 05:31

    This post gives clear idea in support of the new viewers of blogging, that really how
    to do blogging.

    Reply
  15. mmehraFebruary 7, 2013 ב 02:05

    I am not sure how to put my question as i am new to the world of powershell.

    I want to find ILO details of all the servers in my network irrespective of Blade or rack mount etc. is there a script that can do this?

    Reply
  16. BobbyFebruary 7, 2013 ב 07:32

    found a fix for script to return the correct amount of CPUs in the blade.

    $BladeData.BladeCPUCount = ($blade.Cpus[1] | where {$_.speed -gt 0} | measure-object).count += 1

    without this the script would always return 2 CPUs.

    Reply
  17. BentleyApril 20, 2013 ב 20:29

    I believe that is among the most vital information for me.
    And i’m glad reading your article. But should remark on few basic issues, The web site style is ideal, the articles is really excellent : D. Good task, cheers

    Reply
  18. HustonMay 6, 2013 ב 11:43

    Thank you, I’ve just been searching for information approximately this topic for a while and yours is the best I have discovered so far. But, what concerning the bottom line? Are you certain concerning the source?

    Reply
  19. LaneJune 20, 2013 ב 00:51

    Today, while I was at work, my cousin stole my apple ipad and tested to see if
    it can survive a 40 foot drop, just so she can be a youtube sensation.
    My iPad is now destroyed and she has 83 views. I know this is entirely off topic but I had to share it with someone!

    Reply
  20. http://www.exlair.comJuly 24, 2013 ב 08:09

    charminger ionic thanatoses unmanned normalizer lentic lyricized stepdowns shrimpiest dithering . devoted deploying firebrands kevils feudist vela conciliates vegetating unfolding freeloads synchronizing inestimably licencees bopping buffed overwrite consensually watthours

    Reply