VMware Cloud Community
esxi1979
Expert
Expert

HP powershell iIo info - Generic Powershell

Hello

can someone help me get the o/p from the array in csv

===

here is the code

$csv= import-csv c:\temp\hp-ilo-list.csv

&{foreach ($line in $csv) {

Get-HPiLONICInfo -DisableCertificateAuthentication -Server $($line.name) -Username "xx" -Password "xx"

}} | Export-Csv -NoTypeInformation -UseCulture c:\work\data\$loc\hp-BP-ilo-$date.csv

===============

IP             : xx

HOSTNAME       : xx

STATUS_TYPE    : OK

STATUS_MESSAGE : OK

iLO            : @{IP_ADDRESS=xx; LOCATION=Embedded; MAC_ADDRESS=xx; NETWORK_PORT=iLO Dedicated Network Port; PORT_DESCRIPTION=iLO Dedicated Network Port; STATUS=OK}

NIC            : {@{IP_ADDRESS=N/A; LOCATION=Embedded; MAC_ADDRESS=xx; NETWORK_PORT=Port 1; PORT_DESCRIPTION=N/A; STATUS=Unknown}, @{IP_ADDRESS=N/A; LOCATION=Embedded; MAC_ADDRESS=xx; NETWORK_PORT=Port 2; PORT_DESCRIPTION=N/A; STATUS=Unknown}, @{IP_ADDRESS=N/A;

                 LOCATION=Embedded; MAC_ADDRESS=xx; NETWORK_PORT=Port 3; PORT_DESCRIPTION=N/A; STATUS=Unknown}, @{IP_ADDRESS=N/A; LOCATION=Embedded; MAC_ADDRESS=xx; NETWORK_PORT=Port 4; PORT_DESCRIPTION=N/A; STATUS=Unknown}...}

=====================

their help for the cmdlet is

get-help Get-HPiLONICInfo

NAME

    Get-HPiLONICInfo

SYNOPSIS

    Gets the NIC details for the system NIC and the iLO NIC.

SYNTAX

    Get-HPiLONICInfo -Server <String, PSObject, Array List, list of String and/or PSObject> [-Credential <PSCredential[], PSObject, list of PSCredential and/or PSObject>] [-Username <String, PSObject, Array List, list of String and/or PSObject>] [-Password <String, PSObject, Array List, list of

    String and/or PSObject>] [-Type <String, PSObject, Array List, list of String and/or PSObject>] [-OutputType <String>] [-Force <SwitchParameter>] [-DisableCertificateAuthentication <SwitchParameter>] [<CommonParameters>]

DESCRIPTION

    The Get-HPiLONICInfo cmdlet gets the NIC details of the system NIC and the iLO NIC. These details include IP address, MAC Address, network port and port description for both the system NICs and the iLO NICs.

    A list of servers (with or without port number) and corresponding username/password or credential values must be provided as parameters.

RELATED LINKS

    http://www.hpe.com/servers/powershell

REMARKS

    To see the examples, type: "get-help Get-HPiLONICInfo -examples".

    For more information, type: "get-help Get-HPiLONICInfo -detailed".

    For technical information, type: "get-help Get-HPiLONICInfo -full".

    For online help, type: "get-help Get-HPiLONICInfo -online"

PS C:\temp> get-help Get-HPiLONICInfo -full

NAME

    Get-HPiLONICInfo

SYNOPSIS

    Gets the NIC details for the system NIC and the iLO NIC.

SYNTAX

    Get-HPiLONICInfo -Server <String, PSObject, Array List, list of String and/or PSObject> [-Credential <PSCredential[], PSObject, list of PSCredential and/or PSObject>] [-Username <String, PSObject, Array List, list of String and/or PSObject>] [-Password <String, PSObject, Array List, list of

    String and/or PSObject>] [-Type <String, PSObject, Array List, list of String and/or PSObject>] [-OutputType <String>] [-Force <SwitchParameter>] [-DisableCertificateAuthentication <SwitchParameter>] [<CommonParameters>]

DESCRIPTION

    The Get-HPiLONICInfo cmdlet gets the NIC details of the system NIC and the iLO NIC. These details include IP address, MAC Address, network port and port description for both the system NICs and the iLO NICs.

    A list of servers (with or without port number) and corresponding username/password or credential values must be provided as parameters.

PARAMETERS

    -Server <String, PSObject, Array List, list of String and/or PSObject>

        Specifies the list of iLO with details in PowerShell object format or in a string format. The PowerShell object may contain fields such as IP Address, Hostname, or FQDN. The object may also contain the userid and password required to access the iLO. A range of iLO IPs can also be provided

        in the same string.

        IPv6 values for IP address can be used on iLO 3 firmware version 1.70 and later and also on iLO 4 firmware version 1.40 and later.

        The following are examples of Server parameters:

        Example 1.

        $serverSet1 = "81.2.84.150"

        Example 2.

        $serverSet2 = New-Object PSObject |

                    Add-Member NoteProperty IP  81.2.84.150 -PassThru |

                    Add-Member NoteProperty SPN "ProLiant DL360p Gen8" -PassThru |

                    Add-Member NoteProperty FWRI 1.10 -PassThru |

                    Add-Member NoteProperty PN "Integrated Lights-Out 4 (iLO 4)" -PassThru |

                    Add-Member NoteProperty HOSTNAME ilomxq12345cs.company.net -PassThru |

                    Add-Member NoteProperty MACADDRESS 00:A0:C9:14:C8:29 -PassThru

        Example 3.

        $serverObj1 = New-Object PSObject |

                    Add-Member NoteProperty IP  81.2.84.150 -PassThru |

                    Add-Member NoteProperty SPN "ProLiant DL360p Gen8" -PassThru |

                    Add-Member NoteProperty FWRI 1.10 -PassThru |

                    Add-Member NoteProperty PN "Integrated Lights-Out 4 (iLO 4)" -PassThru |

                    Add-Member NoteProperty HOSTNAME ilomxq12345cs.company.net -PassThru |

                    Add-Member NoteProperty MACADDRESS 00:A0:C9:14:C8:29 -PassThru

        $serverSet1 = @("81.2.84.150", $serverObj1,"81.2.88.158,161", "81.2.88.170-175", "2607:f0d0:1002:51::4")

        Example 4.

        $serverSet4 = "81.2.84.150:8888"

        Example 5.

        $serverSet5 = "[2607:f0d0:1002:51::4]:8888"

        Example 6.

        $serverSet6 = New-Object -TypeName System.Collections.ArrayList

        $serverSet6.Add("81.2.84.150")

        $serverSet6.Add("81.2.88.158,161")

        $serverSet6.Add("81.2.88.170-175")

        Required?                    true

        Position?                    named

        Default value                None

        Accept pipeline input?       true (ByValue, ByPropertyName)

        Accept wildcard characters?  false

    -Credential <PSCredential[], PSObject, list of PSCredential and/or PSObject>

        Credential object Array based on username and password to log onto the iLO. Credential should not be used along with Username/Password.

        Required?                    false

        Position?                    named

        Default value                None

        Accept pipeline input?       true (ByPropertyName)

        Accept wildcard characters?  false

    -Username <String, PSObject, Array List, list of String and/or PSObject>

        Specifies the single username for all the iLOs or a list of usernames for each iLO in the input iLO list. It can be a single string or it can be a collection of usernames in the form of a string array.

        Required?                    false

        Position?                    named

        Default value                None

        Accept pipeline input?       true (ByPropertyName)

        Accept wildcard characters?  false

    -Password <String, PSObject, Array List, list of String and/or PSObject>

        Specifies the single password for all the iLOs or a list of passwords for each iLO in the input iLO list. It can be a single string or it can be a collection of passwords in the form of a string array.

        Required?                    false

        Position?                    named

        Default value                None

        Accept pipeline input?       true (ByPropertyName)

        Accept wildcard characters?  false

    -Type <String, PSObject, Array List, list of String and/or PSObject>

        This indicates the type of NIC for which details are required. Possible values are NIC or iLO. If this parameter is not specified then both, system NIC and iLO NIC information is output.

        Required?                    false

        Position?                    named

        Default value

        Accept pipeline input?       true (ByPropertyName)

        Accept wildcard characters?  false

    -OutputType <String>

        Specifies the type of required output. Possible value can be ExternalCommand, XML, RIBCL, or PSObject. Default value is PSObject.

        The value ExternalCommand for the parameter OutputType creates RIBCL command with other details that are passed to the OA cmdlet Invoke-HPOAiLOCommand from HPOACmdlets. See the user guide for an example.

        Required?                    false

        Position?                    named

        Default value                PSObject

        Accept pipeline input?       false

        Accept wildcard characters?  false

    -Force <SwitchParameter>

        Suppresses the prompt that asks for a required parameter. Without this parameter, Get-HPiLONICInfo requires you to provide the values of all required parameters that are missing, interactively. Setting this will cause an error for any missing required parameters.

        Required?                    false

        Position?                    named

        Default value

        Accept pipeline input?       false

        Accept wildcard characters?  false

    -DisableCertificateAuthentication <SwitchParameter>

        If this switch parameter is present then server certificate authentication is disabled for the execution of this cmdlet. If not present it will execute according to the global certificate authentication setting. The default is to authenticate server certificates. See

        Enable-HPiLOCertificateAuthentication and Disable-HPiLOCertificateAuthentication to set the per PowerShell session default.

        Required?                    false

        Position?                    named

        Default value

        Accept pipeline input?       false

        Accept wildcard characters?  false

    <CommonParameters>

        This cmdlet supports the common parameters: Verbose, Debug,

        ErrorAction, ErrorVariable, WarningAction, WarningVariable,

        OutBuffer, PipelineVariable, and OutVariable. For more information, see

        about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

INPUTS

    PSObject OR array of PSObject OR String OR array of String

        You can pipe one IP address or a list of IP addresses as Strings, or one PSObject or list of PSObjects having the iLO details such as IP Address, Hostname, Username and Password to access the iLO.

OUTPUTS

        PSObject[] is returned. Use Get-Member to get details of fields in returned objects.

NOTES

        Some forms of command line parameters must be enclosed in quotes for correct interpretation by the system. For example, a string parameter of 1234 is interpreted as a number instead of a string without quotes. An IP address set of 10.10.10.11,33 would also be misinterpreted.

        Use either "1234" or "10.10.10.11,33" to get the expected results.

    -------------------------- EXAMPLE 1 --------------------------

    PS C:\> Get-HPiLONICInfo

    Please enter Server IP or Hostname: 1.4.217.131,187

    Do you want to add details for another server?(Y/N) : y

    Please enter Server IP or Hostname: 1.4.209.53

    Do you want to add details for another server?(Y/N) : n

    Username is not provided for the following iLO Server(s):

    1.4.217.131

    1.4.217.187

    1.4.209.53

    Use same Username for these servers? (Y/N) : N

    Enter Username for 1.4.217.131: administrator

    Enter Username for 1.4.217.187: alansmith

    Enter Username for 1.4.209.53: timhorton

    Password is not provided for the following iLO Server(s):

    1.4.217.131

    1.4.217.187

    1.4.209.53

    Use same Password for these servers? (Y/N) : N

    Enter Password for 1.4.217.131: ************

    Enter Password for 1.4.217.187: ************

    Enter Password for 1.4.209.53: ************

    IP             : 1.4.217.131

    HOSTNAME       : iloqwc.company.net

    STATUS_TYPE    : OK

    STATUS_MESSAGE : OK

    iLO_4          : {@{IP_ADDRESS=10.84.217.103; MAC_ADDRESS=98:4b:e1:7d:42:1c; NETWORK_PORT=iLO Dedicated Network Port;

                     PORT_DESCRIPTION=iLO Dedicated Network Port; STATUS=OK}}

    NIC            : {@{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:de:90; NETWORK_PORT=Port 1; PORT_DESCRIPTION=N/A; STATUS=Other},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:45:91; NETWORK_PORT=Port 2; PORT_DESCRIPTION=N/A; STATUS=Other},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:79:92; NETWORK_PORT=Port 3; PORT_DESCRIPTION=N/A; STATUS=Other},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:de:93; NETWORK_PORT=Port 4; PORT_DESCRIPTION=N/A; STATUS=Other}}

    IP             : 1.4.217.187

    HOSTNAME       : ilo.company.net

    STATUS_TYPE    : OK

    STATUS_MESSAGE : OK

    iLO_4          : {@{IP_ADDRESS=10.84.217.103; MAC_ADDRESS=98:4b:e1:7d:42:1c; NETWORK_PORT=iLO Dedicated Network Port;

                     PORT_DESCRIPTION=iLO Dedicated Network Port; STATUS=OK}}

    NIC            : {@{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:36:db:21; NETWORK_PORT=Port 1; PORT_DESCRIPTION=N/A; STATUS=Other},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:36:bd:22; NETWORK_PORT=Port 2; PORT_DESCRIPTION=N/A; STATUS=Other},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:36:db:23; NETWORK_PORT=Port 3; PORT_DESCRIPTION=N/A; STATUS=Other},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:36:de:24; NETWORK_PORT=Port 4; PORT_DESCRIPTION=N/A; STATUS=Other}}

    IP             : 1.4.209.53

    HOSTNAME       : ilomxq.company.net

    STATUS_TYPE    : OK

    STATUS_MESSAGE : OK

    iLO_4          : {@{IP_ADDRESS=10.84.217.103; MAC_ADDRESS=98:4b:e1:7d:42:1c; NETWORK_PORT=iLO Dedicated Network Port;

                     PORT_DESCRIPTION=iLO Dedicated Network Port; STATUS=OK}}

    NIC            : {@{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:de:90; NETWORK_PORT=Port 1; PORT_DESCRIPTION=N/A; STATUS=Other},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:de:91; NETWORK_PORT=Port 2; PORT_DESCRIPTION=N/A; STATUS=Other},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:de:92; NETWORK_PORT=Port 3; PORT_DESCRIPTION=N/A; STATUS=Other},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:de:93; NETWORK_PORT=Port 4; PORT_DESCRIPTION=N/A; STATUS=Other}}

    This command shows a basic usage scenario where only the cmdlet name is entered. You are asked if the same credentials are to be used for multiple input servers or if separate credentials have to be collected for each server. Then you are asked if the same values for parameters are to be

    passed to the cmdlets or separate parameters are going to be used for each server. A list of iLO details is passed to the cmdlet in the form of PowerShell object or list of PowerShell objects or list of IP addresses of the iLO.

    -------------------------- EXAMPLE 2 --------------------------

    PS C:\> Get-HPiLONICInfo -Server $Server

    Username is not provided for the following iLO Server(s):

    1.4.217.131

    1.4.217.187

    1.4.209.53

    Use same Username for these servers? (Y/N) : Y

    Please enter Username : alansmith

    Password is not provided for the following iLO Server(s):

    1.4.217.131

    1.4.217.187

    1.4.209.53

    Use same Password for these servers? (Y/N) : Y

    Please enter Password : ************

    IP             : 1.4.217.131

    HOSTNAME       : iloqwc.company.net

    STATUS_TYPE    : OK

    STATUS_MESSAGE : OK

    iLO_4          : {@{IP_ADDRESS=10.84.217.103; MAC_ADDRESS=98:4b:e1:7d:42:1c; NETWORK_PORT=iLO Dedicated Network Port;

                     PORT_DESCRIPTION=iLO Dedicated Network Port; STATUS=OK}}

    NIC            : {@{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:de:90; NETWORK_PORT=Port 1; PORT_DESCRIPTION=N/A; STATUS=OK},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:45:91; NETWORK_PORT=Port 2; PORT_DESCRIPTION=N/A; STATUS=OK},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:79:92; NETWORK_PORT=Port 3; PORT_DESCRIPTION=N/A; STATUS=Other},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:de:93; NETWORK_PORT=Port 4; PORT_DESCRIPTION=N/A; STATUS=OK}}

    IP             : 1.4.217.187

    HOSTNAME       : ilo.company.net

    STATUS_TYPE    : OK

    STATUS_MESSAGE : OK

    iLO_4          : {@{IP_ADDRESS=10.84.217.103; MAC_ADDRESS=98:4b:e1:7d:42:1c; NETWORK_PORT=iLO Dedicated Network Port;

                     PORT_DESCRIPTION=iLO Dedicated Network Port; STATUS=OK}}

    NIC            : {@{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:36:db:21; NETWORK_PORT=Port 1; PORT_DESCRIPTION=N/A; STATUS=OK},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:36:bd:22; NETWORK_PORT=Port 2; PORT_DESCRIPTION=N/A; STATUS=OK},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:36:db:23; NETWORK_PORT=Port 3; PORT_DESCRIPTION=N/A; STATUS=OK},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:36:de:24; NETWORK_PORT=Port 4; PORT_DESCRIPTION=N/A; STATUS=OK}}

    IP             : 1.4.209.53

    HOSTNAME       : ilomxq.company.net

    STATUS_TYPE    : OK

    STATUS_MESSAGE : OK

    iLO_4          : {@{IP_ADDRESS=10.84.217.103; MAC_ADDRESS=98:4b:e1:7d:42:1c; NETWORK_PORT=iLO Dedicated Network Port;

                     PORT_DESCRIPTION=iLO Dedicated Network Port; STATUS=OK}}

    NIC            : {@{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:de:90; NETWORK_PORT=Port 1; PORT_DESCRIPTION=N/A; STATUS=Other},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:de:91; NETWORK_PORT=Port 2; PORT_DESCRIPTION=N/A; STATUS=OK},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:de:92; NETWORK_PORT=Port 3; PORT_DESCRIPTION=N/A; STATUS=Other},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:de:93; NETWORK_PORT=Port 4; PORT_DESCRIPTION=N/A; STATUS=Other}}

    $Server is passed as parameter to Get-HPiLONICInfo. It can be a string array having iLO IP addresses in string format or it can be an array of PowerShell objects having iLO details including IP address. Because the username and passwords are not provided for the iLOs, you are asked to input

    these values.

    -------------------------- EXAMPLE 3 --------------------------

    PS C:\> Get-HPiLONICInfo -Server $Server -Username $Username -Password $Password

    IP             : 1.4.217.131

    HOSTNAME       : iloqwc.company.net

    STATUS_TYPE    : OK

    STATUS_MESSAGE : OK

    iLO_4          : {@{IP_ADDRESS=10.84.217.103; MAC_ADDRESS=98:4b:e1:7d:42:1c; NETWORK_PORT=iLO Dedicated Network Port;

                     PORT_DESCRIPTION=iLO Dedicated Network Port; STATUS=OK}}

    NIC            : {@{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:de:90; NETWORK_PORT=Port 1; PORT_DESCRIPTION=N/A; STATUS=OK},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:45:91; NETWORK_PORT=Port 2; PORT_DESCRIPTION=N/A; STATUS=OK},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:79:92; NETWORK_PORT=Port 3; PORT_DESCRIPTION=N/A; STATUS=Other},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:de:93; NETWORK_PORT=Port 4; PORT_DESCRIPTION=N/A; STATUS=OK}}

    IP             : 1.4.217.187

    HOSTNAME       : ilo.company.net

    STATUS_TYPE    : OK

    STATUS_MESSAGE : OK

    iLO_4          : {@{IP_ADDRESS=10.84.217.103; MAC_ADDRESS=98:4b:e1:7d:42:1c; NETWORK_PORT=iLO Dedicated Network Port;

                     PORT_DESCRIPTION=iLO Dedicated Network Port; STATUS=OK}}

    NIC            : {@{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:36:db:21; NETWORK_PORT=Port 1; PORT_DESCRIPTION=N/A; STATUS=OK},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:36:bd:22; NETWORK_PORT=Port 2; PORT_DESCRIPTION=N/A; STATUS=OK},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:36:db:23; NETWORK_PORT=Port 3; PORT_DESCRIPTION=N/A; STATUS=OK},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:36:de:24; NETWORK_PORT=Port 4; PORT_DESCRIPTION=N/A; STATUS=OK}}

    IP             : 1.4.209.53

    HOSTNAME       : ilomxq.company.net

    STATUS_TYPE    : OK

    STATUS_MESSAGE : OK

    iLO_4          : {@{IP_ADDRESS=10.84.217.103; MAC_ADDRESS=98:4b:e1:7d:42:1c; NETWORK_PORT=iLO Dedicated Network Port;

                     PORT_DESCRIPTION=iLO Dedicated Network Port; STATUS=OK}}

    NIC            : {@{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:de:90; NETWORK_PORT=Port 1; PORT_DESCRIPTION=N/A; STATUS=Other},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:de:91; NETWORK_PORT=Port 2; PORT_DESCRIPTION=N/A; STATUS=OK},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:de:92; NETWORK_PORT=Port 3; PORT_DESCRIPTION=N/A; STATUS=Other},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:de:93; NETWORK_PORT=Port 4; PORT_DESCRIPTION=N/A; STATUS=Other}}

    This command shows that the list of iLO server addresses is passed as a parameter along with usernames and passwords.

    -------------------------- EXAMPLE 4 --------------------------

    PS C:\> Get-HPiLONICInfo -Server $Server -Username $Username -Password $Password -Type NIC

    IP             : 1.4.217.131

    HOSTNAME       : iloqwc.company.net

    STATUS_TYPE    : OK

    STATUS_MESSAGE : OK

    NIC            : {@{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:de:90; NETWORK_PORT=Port 1; PORT_DESCRIPTION=N/A; STATUS=OK},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:45:91; NETWORK_PORT=Port 2; PORT_DESCRIPTION=N/A; STATUS=OK},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:79:92; NETWORK_PORT=Port 3; PORT_DESCRIPTION=N/A; STATUS=Other},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:de:93; NETWORK_PORT=Port 4; PORT_DESCRIPTION=N/A; STATUS=OK}}

    IP             : 1.4.217.187

    HOSTNAME       : ilo.company.net

    STATUS_TYPE    : OK

    STATUS_MESSAGE : OK

    NIC            : {@{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:36:db:21; NETWORK_PORT=Port 1; PORT_DESCRIPTION=N/A; STATUS=OK},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:36:bd:22; NETWORK_PORT=Port 2; PORT_DESCRIPTION=N/A; STATUS=OK},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:36:db:23; NETWORK_PORT=Port 3; PORT_DESCRIPTION=N/A; STATUS=OK},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:36:de:24; NETWORK_PORT=Port 4; PORT_DESCRIPTION=N/A; STATUS=OK}}

    IP             : 1.4.209.53

    HOSTNAME       : ilomxq.company.net

    STATUS_TYPE    : OK

    STATUS_MESSAGE : OK

    NIC            : {@{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:de:90; NETWORK_PORT=Port 1; PORT_DESCRIPTION=N/A; STATUS=Other},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:de:91; NETWORK_PORT=Port 2; PORT_DESCRIPTION=N/A; STATUS=OK},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:de:92; NETWORK_PORT=Port 3; PORT_DESCRIPTION=N/A; STATUS=Other},

                     @{IP_ADDRESS=N/A; MAC_ADDRESS=ac:16:2d:70:de:93; NETWORK_PORT=Port 4; PORT_DESCRIPTION=N/A; STATUS=Other}}

    This command shows that the list of iLO server addresses is passed as a parameter along with usernames and passwords. The Type parameter is specified as NIC. The output shows only NIC details and NO iLO NIC details are seen in the output

RELATED LINKS

    http://www.hpe.com/servers/powershell

PS C:\temp>

#############################################################

$csv= import-csv c:\temp\hp-ilo-list.csv

&{foreach ($line in $csv) {

Get-HPiLONICInfo -DisableCertificateAuthentication -Server $($line.name) -Username "xx" -Password "xx"

}} | Export-Csv -NoTypeInformation -UseCulture c:\work\data\$loc\hp-BP-ilo-$date.csv

===============

IP             : xx

HOSTNAME       : xx

STATUS_TYPE    : OK

STATUS_MESSAGE : OK

iLO            : @{IP_ADDRESS=xx; LOCATION=Embedded; MAC_ADDRESS=xx; NETWORK_PORT=iLO Dedicated Network Port; PORT_DESCRIPTION=iLO Dedicated Network Port; STATUS=OK}

NIC            : {@{IP_ADDRESS=N/A; LOCATION=Embedded; MAC_ADDRESS=xx; NETWORK_PORT=Port 1; PORT_DESCRIPTION=N/A; STATUS=Unknown}, @{IP_ADDRESS=N/A; LOCATION=Embedded; MAC_ADDRESS=xx; NETWORK_PORT=Port 2; PORT_DESCRIPTION=N/A; STATUS=Unknown}, @{IP_ADDRESS=N/A;

                 LOCATION=Embedded; MAC_ADDRESS=xx; NETWORK_PORT=Port 3; PORT_DESCRIPTION=N/A; STATUS=Unknown}, @{IP_ADDRESS=N/A; LOCATION=Embedded; MAC_ADDRESS=xx; NETWORK_PORT=Port 4; PORT_DESCRIPTION=N/A; STATUS=Unknown}...}

Reply
0 Kudos
5 Replies
LucD
Leadership
Leadership

Several of the properties returned by that cmdlet are objects, or arrays of objects, themselves.

That is why you see those special notations in the output with the curly braces.

The Export-Csv cmdlet expects singular values in a property.

You can use calculated properties to get those.

As an example:

$csv= import-csv c:\temp\hp-ilo-list.csv

&{foreach ($line in $csv) {

Get-HPiLONICInfo -DisableCertificateAuthentication -Server $($line.name) -Username "xx" -Password "xx" |

Select HostName,

    @{N='iLOIP';E={$_.iLO.IP}},

    @{N='NicIP';E={$_.NIC.IP -join '|'}}

}} | Export-Csv -NoTypeInformation -UseCulture c:\work\data\$loc\hp-BP-ilo-$date.csv

 


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
kirandpesx
Contributor
Contributor

i see the o/p as

   

HOSTNAMEiLOIPNicIP
xxx|||||
Reply
0 Kudos
LucD
Leadership
Leadership

Ok, seems the property name for the IP field is IP_Address.

Try like this

$csv= import-csv c:\temp\hp-ilo-list.csv

&{foreach ($line in $csv) {

Get-HPiLONICInfo -DisableCertificateAuthentication -Server $($line.name) -Username "xx" -Password "xx" |

Select HostName,

    @{N='iLOIP';E={$_.iLO.IP_Address}},

    @{N='NicIP';E={$_.NIC.IP_Address -join '|'}}

}} | Export-Csv -NoTypeInformation -UseCulture c:\work\data\$loc\hp-BP-ilo-$date.csv


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
esxi1979
Expert
Expert

now it

 

NicIP
N/A|N/A|N/A|N/A|N/A|N/A
N/A|N/A|N/A|N/A|N/A|N/A
N/A|N/A|N/A|N/A|N/A|N/A
N/A|N/A|N/A|N/A|N/A|N/A
Reply
0 Kudos
LucD
Leadership
Leadership

I'm afraid those are the actual values of the properties.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos