Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

How to display the contents of an array

$
0
0

Hi!

I have an array with two objects in it:

$i = "ServerA"
$RC = 1030

$Array_object = New-Object System.Object
$Array = @()

$Array_object | Add-Member -type NoteProperty -Name Instance -Value $i
        $Array_object | Add-Member -type NoteProperty -Name RowCount -Value $RC

$Array += $Array_object
$Array

If I run the above I get an ouput that looks like this:

Instance                Rowcount

----------               -----------

ServerA                 {Microsoft.PowerShell.Commands.Internal.Format.FormatStartData, Microsoft.PowerShell.Commands.Internal.Format.GroupStartData, Microsoft.PowerShell.Commands.Internal....

Why is the Rowcount not showing the value?

If I run $Array.Rowcount it correctly returns '1030'

Thanks,

Zoe


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>