# Data missing while using Select-Object \*

**URL:** <https://forums.powershell.org/t/data-missing-while-using-select-object/25040>\
**Category:** Uncategorized\
**Created:** [November 20, 2024, 2:27pm UTC](https://forums.powershell.org/t/data-missing-while-using-select-object/25040 "2024-11-20T14:27:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![james616616](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/james616616/32/5741_2.png) [@james616616](https://forums.powershell.org/u/james616616)\
**Post date:** [November 20, 2024, 2:27pm UTC](https://forums.powershell.org/t/data-missing-while-using-select-object/25040/1 "2024-11-20T14:27:53Z")

</div>

Hi, I have a System.Array with data in it ,  
but while I try to output it to somewhere else, I cant get a proper data display.  
Export-CSV will alo have the same result with `$new | Select-Object *`

 ![image](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/2X/0/0367bddaed39ec41e5665745aba752f23eb8c4c3.png)

I assume that the type is wrong but I have no any ideas.  
Please point out my misstake. Many thanks.

James

---

<div class="post-metadata">

**Author:** ![grey0ut](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/grey0ut/32/5310_2.png) [@grey0ut](https://forums.powershell.org/u/grey0ut)\
**Post date:** [November 20, 2024, 3:27pm UTC](https://forums.powershell.org/t/data-missing-while-using-select-object/25040/2 "2024-11-20T15:27:34Z")

</div>

On mobile so this will be short.  
Your error with Out-GridView is because you can’t pass an array to that cmdlet’s default parameter. You need to pipe the array to Out-GridView.

After that you pipe your array to Format-Custom which technically changes all of your output to formatting objects. Format-\* cmdlets should never be used for anything except displaying data on the console. If you want to be able to do something else with that data, like turn it into a csv, you shouldn’t run formatting cmdlets on it.

---

<div class="post-metadata">

**Author:** ![vern\_anderson](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/vern_anderson/32/5140_2.png) [@vern\_anderson](https://forums.powershell.org/u/vern_anderson)\
**Post date:** [November 20, 2024, 3:29pm UTC](https://forums.powershell.org/t/data-missing-while-using-select-object/25040/3 "2024-11-20T15:29:17Z")

</div>

Instead of trying to pass your variable as a parameter to Out-Gridview try piping it in instead.

`$OnlineADComputerList | Out-Gridview`

Or you could try actually using the paramter Out-GridView -InputObject $OnlineADComputerList

---

<div class="post-metadata">

**Author:** ![grey0ut](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/grey0ut/32/5310_2.png) [@grey0ut](https://forums.powershell.org/u/grey0ut)\
**Post date:** [November 20, 2024, 4:52pm UTC](https://forums.powershell.org/t/data-missing-while-using-select-object/25040/4 "2024-11-20T16:52:55Z")

</div>

> [@vern\_anderson](#):
>
> Or you could try actually using the paramter Out-GridView -InputObject $OnlineADComputerList

I would advise against that. The help info for Out-GridView shows that the -InputObject parameter only accepts a single object:  
[Out-GridView Help](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/out-gridview?view=powershell-7.4&viewFallbackFrom=powershell-3.0)

Now that I’m on a computer i’ll step through this a bit more.  
At the beginning you call the array `$OnlineADComputerList` and we can see that it only contains string objects; names of computers.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/2X/e/e05132344cac0e01dc9feea5a25c8dcaedbe25ba.png)  
Then you try to pass it to Out-GridView and receive an error. This can be fixed by piping it to Out-GridView instead. Example:

```auto
$OnlineADComputerList | Out-GridView

```

Which nets you something like this

 ![image](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/2X/6/66db44772ee8ac9800b614132e0a0992594d2d2e.png)  
Since the input objects are just strings there aren’t really any properties for Out-GridView to magically turn in to columns, so it’s just a list.  
When you used the GetType method on `$OnlineADComputerList` it correctly returned that it was an Array object, but that’s not what the contents of the array are. One way you could see that is to pipe the array to Get-Member and you’ll see something like this:

```auto
PS #> $OnlineADComputerList | gm

   TypeName: System.String

Name MemberType Definition
---- ---------- ----------
Clone Method System.Object Clone(), System.Object ICloneable.Clone()
CompareTo Method int CompareTo(System.Object value), int CompareTo(string strB), int IComparable.CompareTo(System.Object obj...
Contains Method bool Contains(string value)
CopyTo Method void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count)
EndsWith Method bool EndsWith(string value), bool EndsWith(string value, System.StringComparison comparisonType), bool Ends...
Equals Method bool Equals(System.Object obj), bool Equals(string value), bool Equals(string value, System.StringCompariso...
GetEnumerator Method System.CharEnumerator GetEnumerator(), System.Collections.IEnumerator IEnumerable.GetEnumerator(), System.C...
GetHashCode Method int GetHashCode()
GetType Method type GetType()
GetTypeCode Method System.TypeCode GetTypeCode(), System.TypeCode IConvertible.GetTypeCode()
IndexOf Method int IndexOf(char value), int IndexOf(char value, int startIndex), int IndexOf(string value), int IndexOf(st...
IndexOfAny Method int IndexOfAny(char[] anyOf), int IndexOfAny(char[] anyOf, int startIndex), int IndexOfAny(char[] anyOf, in...
Insert Method string Insert(int startIndex, string value)
IsNormalized Method bool IsNormalized(), bool IsNormalized(System.Text.NormalizationForm normalizationForm)
LastIndexOf Method int LastIndexOf(char value), int LastIndexOf(char value, int startIndex), int LastIndexOf(string value), in...
LastIndexOfAny Method int LastIndexOfAny(char[] anyOf), int LastIndexOfAny(char[] anyOf, int startIndex), int LastIndexOfAny(char...
Normalize Method string Normalize(), string Normalize(System.Text.NormalizationForm normalizationForm)
PadLeft Method string PadLeft(int totalWidth), string PadLeft(int totalWidth, char paddingChar)
PadRight Method string PadRight(int totalWidth), string PadRight(int totalWidth, char paddingChar)
Remove Method string Remove(int startIndex, int count), string Remove(int startIndex)
Replace Method string Replace(char oldChar, char newChar), string Replace(string oldValue, string newValue)
Split Method string[] Split(Params char[] separator), string[] Split(char[] separator, int count), string[] Split(char[]...
StartsWith Method bool StartsWith(string value), bool StartsWith(string value, System.StringComparison comparisonType), bool ...
Substring Method string Substring(int startIndex), string Substring(int startIndex, int length)
ToBoolean Method bool IConvertible.ToBoolean(System.IFormatProvider provider)
ToByte Method byte IConvertible.ToByte(System.IFormatProvider provider)
ToChar Method char IConvertible.ToChar(System.IFormatProvider provider)
ToCharArray Method char[] ToCharArray(), char[] ToCharArray(int startIndex, int length)
ToDateTime Method datetime IConvertible.ToDateTime(System.IFormatProvider provider)
ToDecimal Method decimal IConvertible.ToDecimal(System.IFormatProvider provider)
ToDouble Method double IConvertible.ToDouble(System.IFormatProvider provider)
ToInt16 Method int16 IConvertible.ToInt16(System.IFormatProvider provider)
ToInt32 Method int IConvertible.ToInt32(System.IFormatProvider provider)
ToInt64 Method long IConvertible.ToInt64(System.IFormatProvider provider)
ToLower Method string ToLower(), string ToLower(cultureinfo culture)
ToLowerInvariant Method string ToLowerInvariant()
ToSByte Method sbyte IConvertible.ToSByte(System.IFormatProvider provider)
ToSingle Method float IConvertible.ToSingle(System.IFormatProvider provider)
ToString Method string ToString(), string ToString(System.IFormatProvider provider), string IConvertible.ToString(System.IF...
ToType Method System.Object IConvertible.ToType(type conversionType, System.IFormatProvider provider)
ToUInt16 Method uint16 IConvertible.ToUInt16(System.IFormatProvider provider)
ToUInt32 Method uint32 IConvertible.ToUInt32(System.IFormatProvider provider)
ToUInt64 Method uint64 IConvertible.ToUInt64(System.IFormatProvider provider)
ToUpper Method string ToUpper(), string ToUpper(cultureinfo culture)
ToUpperInvariant Method string ToUpperInvariant()
Trim Method string Trim(Params char[] trimChars), string Trim()
TrimEnd Method string TrimEnd(Params char[] trimChars)
TrimStart Method string TrimStart(Params char[] trimChars)
Chars ParameterizedProperty char Chars(int index) {get;}
Length Property int Length {get;}

```

Now we can see that the contents of the array are String objects.

Piping the array to `Select-Object *` is the equivalent of `Select-Object -Properties *` and from the previous Get-Member output we can see that the _only_ property on a string object is length, so it correctly returned a table of each objects length. I’m not sure what output you were hoping to get from that.

As I mentioned earlier, when you piped the array to Format-Custom, it fundamentally changed all of your data and the resulting output objects became Format info objects instead of your original strings.

---

<div class="post-metadata">

**Author:** ![james616616](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/james616616/32/5741_2.png) [@james616616](https://forums.powershell.org/u/james616616)\
**Post date:** [November 21, 2024, 9:55am UTC](https://forums.powershell.org/t/data-missing-while-using-select-object/25040/5 "2024-11-21T09:55:13Z")

</div>

Thank you ! This worked.  
`$OnlineADComputerList | Out-Gridview`

Seems i have to read more about piping,  
Thanks again!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [December 21, 2024, 9:55am UTC](https://forums.powershell.org/t/data-missing-while-using-select-object/25040/6 "2024-12-21T09:55:15Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
