select parts of output in this code

This topic contains 1 reply, has 2 voices, and was last updated by  Don Jones 5 days, 5 hours ago.

  • Author
    Posts
  • #104348

    sundivider
    Participant

    Hello
    I have a cmdlet for HP servers ILO. output is like this:

    IP : 10.0.87.165
    HOSTNAME :
    STATUS_TYPE : OK
    STATUS_MESSAGE : OK
    BATTERY_STATUS : OK
    BIOS_HARDWARE_STATUS : OK
    FANS : {@{STATUS=OK}, @{REDUNDANCY=Redundant}}
    MEMORY_STATUS : OK
    NETWORK_STATUS : OK
    POWER_SUPPLIES : {@{STATUS=OK}, @{REDUNDANCY=Redundant}}
    PROCESSOR_STATUS : OK
    STORAGE_STATUS : Degraded
    TEMPERATURE_STATUS : OK

    Now I am trying to eliminate all poperties with ok status, and just show Degraded or anything but ok. for any server objects can be different based on ILO version, Then I can't select specific objects and name them so I used "Select-Object *".
    Here is my code. please tell me what is wrong and how can I correct it:

    Get-HPiLOHealthSummary -server 10.0.87.165 -Username sth -Password sthelse -DisableCertificateAuthentication|
    Select-Object * | ForEach-Object {$property,$value = $_.Split(':')
    if($value -ne "OK"){ write-host $property}
    }

  • #104380

    Don Jones
    Keymaster

    Is that output just a bunch of string, or is it properties with values?

You must be logged in to reply to this topic.