1

I have been trying to find out how I can get the value of a property in PowerShell.

For instance, the line below will display the LinkSpeed of the Network Adapter ...

Get-NetAdapter | Select LinkSpeed | Where {$_.LinkSpeed -like '*Gbps'}

Output:

LinkSpeed
---------
10 Gbps

As you can see, you have a Property, 'LinkSpeed', and the Value, '10 Gbps'.

What I have been searching and searching for is how do I extract and display only the Value, '10 Gbps'?

I began by finding out how to select and/or filter through all of the properties of a cmdlet using Select, Select-Object, Where-Object, and -FilterScript as demonstrated in the example above

That got me to where I am now. I cannot find anything describing how to extract only the value of a Property.

I would greatly appreciate help solving this problem.

mklement0
  • 382,024
  • 64
  • 607
  • 775
grippnault
  • 31
  • 6

1 Answers1

1
(Get-NetAdapter | Where {$_.LinkSpeed -like '*Gbps'}).Linkspeed

Gets you an array of strings rather than PSCustomObject.

OwlsSleeping
  • 1,487
  • 2
  • 11
  • 19