chrisnelsonx
chrisnelsonx

Reputation: 31

Powershell: Use specific data from a Get-NetAdapter results as a variable in Powershell ISE

I am attempting to use ifIndex result for a specific network adapter in another powershell command. How would I create a line to pull that specific adapter's ifIndex?

Upvotes: 0

Views: 3901

Answers (2)

Dave
Dave

Reputation: 11

The following code will get your adapter and select the IfIndex property

(get-netadapter -name "AdapterNameHere").IfIndex

Upvotes: 1

Giorgi Chakhidze
Giorgi Chakhidze

Reputation: 3459

Probably something like this:

$ifIndexVariable = Get-NetAdapter -Name 'Specific Adapter Name' | Select-Object -ExpandProperty 'ifIndex'

Upvotes: 1

Related Questions