PowerShell Listing different arrays -


i have 2 different arrays , when list them in script, columns of 2nd one, not appear. if list them individually, list correctly.

for example, when listing in script, output:

name                       ipaddress    numofconnections ----                       ---------    ---------------- srv1                      12.2.2.2                0 srv2                      11.1.1.1                0 vserver1                                               vserver2                                                        

if list each array separately, out:

array1

name                       ipaddress    numofconnections ----                       ---------    ---------------- srv1                      12.2.2.2                0 srv2                      11.1.1.1                0 

array2

name                                 curstate ----                                 -------- vserver1                               vserver2                         down     

i suppose powershell takes first object in array , displays properties of it. if object in list has more properties, won't show them. however, iterate on items , select columns:

$array1, $array2 | foreach { $_ | select name, ipaddress, curstate } 

output:

name     ipaddress curstate ----     --------- -------- srv1     12.2.2.2           srv2     12.1.1.1           vserver1                 vserver2           down     

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -