select parts of output in this code

Welcome Forums General PowerShell Q&A select parts of output in this code

This topic contains 1 reply, has 2 voices, and was last updated by

 
Keymaster
8 months, 2 weeks ago.

  • Author
    Posts
  • #104348

    Participant
    Points: 0
    Rank: Member

    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

    Keymaster
    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

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

The topic ‘select parts of output in this code’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort