Using PoSH to get a value, strange results Using PoSH to get a value, strange results powershell powershell

Using PoSH to get a value, strange results


You are selecting a single property of the object, but still passing an object. What you need to do is use the -ExpandProperty parameter of the Select-Object cmdlet. Change your Select command to this:

| Select -ExpandProperty Name -First 1

That should give you the results that you desire.