Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - How to list ethernet adaptors by name (Local Area Connection name)

Reply
 
Old 08-13-2008   #1 (permalink)
pschmidt


 
 

How to list ethernet adaptors by name (Local Area Connection name)


I'm trying to find a way to list the network adapter information based on
the ethernet adapter as listed by ipconfig - the 'defaults' are 'Local Area
Connection', Local Area Connection 2', etc...

I've found lots of info using Win32_NetworkAdapterConfiguration, and this
gets me most of what I want. But I can't find the 'name' in this object.
How do I get this name? Or is there a way I can get the NICs
Win32_NetworkAdapterConfiguration object with the given name. Either will
work with with I'm doing.

Thx,

Perry


My System SpecsSystem Spec
Old 08-13-2008   #2 (permalink)
tojo2000


 
 

Re: How to list ethernet adaptors by name (Local Area Connectionname)

On Aug 13, 5:23*pm, pschmidt <pschm...@xxxxxx>
wrote:
Quote:

> I'm trying to find a way to list the network adapter information based on
> the ethernet adapter as listed by ipconfig - the 'defaults' are 'Local Area
> Connection', Local Area Connection 2', etc...
>
> I've found lots of info using Win32_NetworkAdapterConfiguration, and this
> gets me most of what I want. *But I can't find the 'name' in this object. *
> How do I get this name? *Or is there a way I can get the NICs
> Win32_NetworkAdapterConfiguration object with the given name. *Either will
> work with with I'm doing.
>
> Thx,
>
> Perry
Does this suit your needs?

gwmi Win32_NetworkAdapterConfiguration | select Caption
My System SpecsSystem Spec
Old 08-13-2008   #3 (permalink)
pschmidt


 
 

Re: How to list ethernet adaptors by name (Local Area Connection n



"tojo2000" wrote:
Quote:

> On Aug 13, 5:23 pm, pschmidt <pschm...@xxxxxx>
> wrote:
Quote:

> > I'm trying to find a way to list the network adapter information based on
> > the ethernet adapter as listed by ipconfig - the 'defaults' are 'Local Area
> > Connection', Local Area Connection 2', etc...
> >
> > I've found lots of info using Win32_NetworkAdapterConfiguration, and this
> > gets me most of what I want. But I can't find the 'name' in this object.
> > How do I get this name? Or is there a way I can get the NICs
> > Win32_NetworkAdapterConfiguration object with the given name. Either will
> > work with with I'm doing.
> >
> > Thx,
> >
> > Perry
>
> Does this suit your needs?
>
> gwmi Win32_NetworkAdapterConfiguration | select Caption
>
No...not quite. This shows me the different adapters. But I want to be
able to find configuration information on a specific adapter based on the
'ipconfig' adapter name. I've not found a way to show this name (typically
'Local Area Connection') in the NEtworkAdapterConfiguration object.

My System SpecsSystem Spec
Old 08-13-2008   #4 (permalink)
Steve Schofield


 
 

Re: How to list ethernet adaptors by name (Local Area Connection n

I just did something similar. I'm not powershell guru, but here is the
logic I did to get certain properties.

#http://www.microsoft.com/technet/scr....mspx?mfr=true
#List all network properties
$strComputer = "localhost"
$colItems = get-wmiobject -query "Select * From
Win32_NetworkAdapterConfiguration Where IPEnabled = 1" -namespace
"root\cimv2" -computername $strComputer

foreach ($objItem in $colItems)
{
write-host "Caption: " $objItem.Caption
write-host "Description: " $objItem.Description
write-host "Index: " $objItem.Index
write-host "MAC Address: " $objItem.MACAddress
write-host "MAC Address: " $objItem.DNSServerSearchOrder
}

Steve Schofield

"pschmidt" <pschmidt@xxxxxx> wrote in message
news:50CEE4E6-E92F-493D-A585-1BB615AE365C@xxxxxx
Quote:

>
>
> "tojo2000" wrote:
>
Quote:

>> On Aug 13, 5:23 pm, pschmidt <pschm...@xxxxxx>
>> wrote:
Quote:

>> > I'm trying to find a way to list the network adapter information based
>> > on
>> > the ethernet adapter as listed by ipconfig - the 'defaults' are 'Local
>> > Area
>> > Connection', Local Area Connection 2', etc...
>> >
>> > I've found lots of info using Win32_NetworkAdapterConfiguration, and
>> > this
>> > gets me most of what I want. But I can't find the 'name' in this
>> > object.
>> > How do I get this name? Or is there a way I can get the NICs
>> > Win32_NetworkAdapterConfiguration object with the given name. Either
>> > will
>> > work with with I'm doing.
>> >
>> > Thx,
>> >
>> > Perry
>>
>> Does this suit your needs?
>>
>> gwmi Win32_NetworkAdapterConfiguration | select Caption
>>
>
> No...not quite. This shows me the different adapters. But I want to be
> able to find configuration information on a specific adapter based on the
> 'ipconfig' adapter name. I've not found a way to show this name
> (typically
> 'Local Area Connection') in the NEtworkAdapterConfiguration object.
>
My System SpecsSystem Spec
Old 08-13-2008   #5 (permalink)
pschmidt


 
 

Re: How to list ethernet adaptors by name (Local Area Connection n

Steve -

This is similar to a script I'm already using. And it prints a lot of info,
but does the $objitem below have a field for the same that prints and you use
to ID adaptors with the ipconfig command - Again, local area connection is
the 'common' name for this. This below doesn't show this name. That's the
name I'm trying to index off of or search for.

It's the same as the 'netsh interface show interface' name. What's the WMI
object/property for this?

"Steve Schofield" wrote:
Quote:

> I just did something similar. I'm not powershell guru, but here is the
> logic I did to get certain properties.
>
> #http://www.microsoft.com/technet/scr....mspx?mfr=true
> #List all network properties
> $strComputer = "localhost"
> $colItems = get-wmiobject -query "Select * From
> Win32_NetworkAdapterConfiguration Where IPEnabled = 1" -namespace
> "root\cimv2" -computername $strComputer
>
> foreach ($objItem in $colItems)
> {
> write-host "Caption: " $objItem.Caption
> write-host "Description: " $objItem.Description
> write-host "Index: " $objItem.Index
> write-host "MAC Address: " $objItem.MACAddress
> write-host "MAC Address: " $objItem.DNSServerSearchOrder
> }
>
> Steve Schofield
>
> "pschmidt" <pschmidt@xxxxxx> wrote in message
> news:50CEE4E6-E92F-493D-A585-1BB615AE365C@xxxxxx
Quote:

> >
> >
> > "tojo2000" wrote:
> >
Quote:

> >> On Aug 13, 5:23 pm, pschmidt <pschm...@xxxxxx>
> >> wrote:
> >> > I'm trying to find a way to list the network adapter information based
> >> > on
> >> > the ethernet adapter as listed by ipconfig - the 'defaults' are 'Local
> >> > Area
> >> > Connection', Local Area Connection 2', etc...
> >> >
> >> > I've found lots of info using Win32_NetworkAdapterConfiguration, and
> >> > this
> >> > gets me most of what I want. But I can't find the 'name' in this
> >> > object.
> >> > How do I get this name? Or is there a way I can get the NICs
> >> > Win32_NetworkAdapterConfiguration object with the given name. Either
> >> > will
> >> > work with with I'm doing.
> >> >
> >> > Thx,
> >> >
> >> > Perry
> >>
> >> Does this suit your needs?
> >>
> >> gwmi Win32_NetworkAdapterConfiguration | select Caption
> >>
> >
> > No...not quite. This shows me the different adapters. But I want to be
> > able to find configuration information on a specific adapter based on the
> > 'ipconfig' adapter name. I've not found a way to show this name
> > (typically
> > 'Local Area Connection') in the NEtworkAdapterConfiguration object.
> >
>
>
My System SpecsSystem Spec
Old 08-13-2008   #6 (permalink)
tojo2000


 
 

Re: How to list ethernet adaptors by name (Local Area Connection n

On Aug 13, 6:58*pm, pschmidt <pschm...@xxxxxx>
wrote:
Quote:

> Steve -
>
> This is similar to a script I'm already using. *And it prints a lot of info,
> but does the $objitem below have a field for the same that prints and youuse
> to ID adaptors with the ipconfig command - Again, local area connection is
> the 'common' name for this. *This below doesn't show this name. *That's the
> name I'm trying to index off of or search for.
>
> It's the same as the 'netsh interface show interface' name. *What's theWMI
> object/property for this?
>
> "Steve Schofield" wrote:
Quote:

> > I just did something similar. *I'm not powershell guru, but here is the
> > logic I did to get certain properties.
>
Quote:

> > #http://www.microsoft.com/technet/scr...sh/network/cli....
> > #List all network properties
> > $strComputer = "localhost"
> > $colItems = get-wmiobject -query "Select * From
> > Win32_NetworkAdapterConfiguration Where IPEnabled = 1" -namespace
> > "root\cimv2" -computername $strComputer
>
Quote:

> > foreach ($objItem in $colItems)
> > {
> > * * * write-host "Caption: " $objItem.Caption
> > * * * write-host "Description: " $objItem.Description
> > * * * write-host "Index: " $objItem.Index
> > * * * write-host "MAC Address: " $objItem.MACAddress
> > * * * write-host "MAC Address: " $objItem.DNSServerSearchOrder
> > }
>
Quote:

> > Steve Schofield
>
Quote:

> > "pschmidt" <pschm...@xxxxxx> wrote in message
> >news:50CEE4E6-E92F-493D-A585-1BB615AE365C@xxxxxx
>
Quote:
Quote:

> > > "tojo2000" wrote:
>
Quote:
Quote:

> > >> On Aug 13, 5:23 pm, pschmidt <pschm...@xxxxxx>
> > >> wrote:
> > >> > I'm trying to find a way to list the network adapter information based
> > >> > on
> > >> > the ethernet adapter as listed by ipconfig - the 'defaults' are 'Local
> > >> > Area
> > >> > Connection', Local Area Connection 2', etc...
>
Quote:
Quote:

> > >> > I've found lots of info using Win32_NetworkAdapterConfiguration, and
> > >> > this
> > >> > gets me most of what I want. *But I can't find the 'name' in this
> > >> > object.
> > >> > How do I get this name? *Or is there a way I can get the NICs
> > >> > Win32_NetworkAdapterConfiguration object with the given name. *Either
> > >> > will
> > >> > work with with I'm doing.
>
Quote:
Quote:

> > >> > Thx,
>
Quote:
Quote:

> > >> > Perry
>
Quote:
Quote:

> > >> Does this suit your needs?
>
Quote:
Quote:

> > >> gwmi Win32_NetworkAdapterConfiguration | select Caption
>
Quote:
Quote:

> > > No...not quite. *This shows me the different adapters. *But I want to be
> > > able to find configuration information on a specific adapter based onthe
> > > 'ipconfig' adapter name. *I've not found a way to show this name
> > > (typically
> > > 'Local Area Connection') in the NEtworkAdapterConfiguration object.
It doesn't look like WMI grabs this information. You'll probably have
to go to the Registry if you want to get it:

Key: HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Network\<GUID>
\Connection
Value: Name

Replace <GUID> with the GUID property of
Win32_NetworkAdapterConfiguration or the SettingID property of
Win32_NetworkAdapter

gwmi -query "Select * from Win32_NetworkAdapterConfiguration where
IPEnabled = 1" |
%{$_; gwmi -query "Select * from Win32_NetworkAdapter where Index = $
($_.Index)"; Write-Host "`n`n---------------------------`n`n"} |
select *

That will give you all of the properties for Network Adapters in WMI,
with the possible exception of the Protocol classes, but the name
isn't in there, either.

My System SpecsSystem Spec
Old 08-15-2008   #7 (permalink)
Shay Levy [MVP]


 
 

Re: How to list ethernet adaptors by name (Local Area Connection name)

Hi pschmidt,

It's a combination on two WMI calls (I'm sure one can merge them into one):



PS > gwmi Win32_NetworkAdapter -filter "netconnectionid is not null"| select
netconnectionid,interfaceindex | ft -auto


netconnectionid interfaceindex
--------------- --------------
Local Area Connection 10
Bluetooth Network Connection 13
Wireless Network Connection 14
Local Area Connection 19




Now you can issue a second WMI call to the interface you need:

PS > gwmi Win32_NetworkAdapterConfiguration -filter "interfaceindex=10"

DHCPEnabled : True
IPAddress :
DefaultIPGateway :
DNSDomain :
ServiceName : e1express
Description : Intel(R) 82566MM Gigabit Network Connection
Index : 4



---
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic



p> I'm trying to find a way to list the network adapter information
p> based on the ethernet adapter as listed by ipconfig - the 'defaults'
p> are 'Local Area Connection', Local Area Connection 2', etc...
p>
p> I've found lots of info using Win32_NetworkAdapterConfiguration, and
p> this gets me most of what I want. But I can't find the 'name' in
p> this object. How do I get this name? Or is there a way I can get
p> the NICs Win32_NetworkAdapterConfiguration object with the given
p> name. Either will work with with I'm doing.
p>
p> Thx,
p>
p> Perry
p>


My System SpecsSystem Spec
Old 08-15-2008   #8 (permalink)
/\\/\\o\\/\\/


 
 

Re: How to list ethernet adaptors by name (Local Area Connection name)

> It's a combination on two WMI calls (I'm sure one can merge them into
Quote:

> one):
$nics = gwmi Win32_NetworkAdapter -f "netconnectionid is not null"
$nics |%
{$_.netconnectionid;$_.GetRelated('Win32_NetworkAdapterConfiguration')}

Enjoy,

Greetings /\/\o\/\/
http://thePowerShellGuy.com

"Shay Levy [MVP]" <no@xxxxxx> wrote in message
news:95d808933de1e8cacce19c013a10@xxxxxx
Quote:

> Hi pschmidt,
>
> It's a combination on two WMI calls (I'm sure one can merge them into
> one):
>
>
>
> PS > gwmi Win32_NetworkAdapter -filter "netconnectionid is not null"|
> select netconnectionid,interfaceindex | ft -auto
>
>
> netconnectionid interfaceindex
> --------------- --------------
> Local Area Connection 10
> Bluetooth Network Connection 13
> Wireless Network Connection 14
> Local Area Connection 19
>
>
>
>
> Now you can issue a second WMI call to the interface you need:
>
> PS > gwmi Win32_NetworkAdapterConfiguration -filter "interfaceindex=10"
>
> DHCPEnabled : True
> IPAddress :
> DefaultIPGateway :
> DNSDomain :
> ServiceName : e1express
> Description : Intel(R) 82566MM Gigabit Network Connection
> Index : 4
>
>
>
> ---
> Shay Levy
> Windows PowerShell MVP
> http://blogs.microsoft.co.il/blogs/ScriptFanatic
>
>
>
> p> I'm trying to find a way to list the network adapter information
> p> based on the ethernet adapter as listed by ipconfig - the 'defaults'
> p> are 'Local Area Connection', Local Area Connection 2', etc...
> p> p> I've found lots of info using Win32_NetworkAdapterConfiguration, and
> p> this gets me most of what I want. But I can't find the 'name' in
> p> this object. How do I get this name? Or is there a way I can get
> p> the NICs Win32_NetworkAdapterConfiguration object with the given
> p> name. Either will work with with I'm doing.
> p> p> Thx,
> p> p> Perry
> p>
>
My System SpecsSystem Spec
Old 08-15-2008   #9 (permalink)
Shay Levy [MVP]


 
 

Re: How to list ethernet adaptors by name (Local Area Connection name)


So COOL!



---
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic


Quote:
Quote:

>> It's a combination on two WMI calls (I'm sure one can merge them into
>> one):
>>
o> $nics = gwmi Win32_NetworkAdapter -f "netconnectionid is not null"
o> $nics |%
o> {$_.netconnectionid;$_.GetRelated('Win32_NetworkAdapterConfiguration'
o> )}
o>
o> Enjoy,
o>
o> Greetings /\/\o\/\/
o> http://thePowerShellGuy.com
o> "Shay Levy [MVP]" <no@xxxxxx> wrote in message
o> news:95d808933de1e8cacce19c013a10@xxxxxx
o>
Quote:
Quote:

>> Hi pschmidt,
>>
>> It's a combination on two WMI calls (I'm sure one can merge them into
>> one):
>>
>> PS > gwmi Win32_NetworkAdapter -filter "netconnectionid is not null"|
>> select netconnectionid,interfaceindex | ft -auto
>>
>> netconnectionid interfaceindex
>> --------------- --------------
>> Local Area Connection 10
>> Bluetooth Network Connection 13
>> Wireless Network Connection 14
>> Local Area Connection 19
>> Now you can issue a second WMI call to the interface you need:
>>
>> PS > gwmi Win32_NetworkAdapterConfiguration -filter
>> "interfaceindex=10"
>>
>> DHCPEnabled : True
>> IPAddress :
>> DefaultIPGateway :
>> DNSDomain :
>> ServiceName : e1express
>> Description : Intel(R) 82566MM Gigabit Network Connection
>> Index : 4
>> ---
>> Shay Levy
>> Windows PowerShell MVP
>> http://blogs.microsoft.co.il/blogs/ScriptFanatic
>> p> I'm trying to find a way to list the network adapter information
>> p> based on the ethernet adapter as listed by ipconfig - the
>> 'defaults'
>> p> are 'Local Area Connection', Local Area Connection 2', etc...
>> p> p> I've found lots of info using
>> Win32_NetworkAdapterConfiguration, and
>> p> this gets me most of what I want. But I can't find the 'name' in
>> p> this object. How do I get this name? Or is there a way I can get
>> p> the NICs Win32_NetworkAdapterConfiguration object with the given
>> p> name. Either will work with with I'm doing.
>> p> p> Thx,
>> p> p> Perry
>> p>

My System SpecsSystem Spec
Old 08-15-2008   #10 (permalink)
Alex K. Angelopoulos


 
 

Re: How to list ethernet adaptors by name (Local Area Connection name)

this is a LOT better than what I was doing. I should have done

gwmi win32_NetworkAdapter | fl *

before all my registry digging. ; )


"Shay Levy [MVP]" <no@xxxxxx> wrote in message
news:95d808933de1e8cacce19c013a10@xxxxxx
Quote:

> Hi pschmidt,
>
> It's a combination on two WMI calls (I'm sure one can merge them into
> one):
>
>
>
> PS > gwmi Win32_NetworkAdapter -filter "netconnectionid is not null"|
> select netconnectionid,interfaceindex | ft -auto
>
>
> netconnectionid interfaceindex
> --------------- --------------
> Local Area Connection 10
> Bluetooth Network Connection 13
> Wireless Network Connection 14
> Local Area Connection 19
>
>
>
>
> Now you can issue a second WMI call to the interface you need:
>
> PS > gwmi Win32_NetworkAdapterConfiguration -filter "interfaceindex=10"
>
> DHCPEnabled : True
> IPAddress :
> DefaultIPGateway :
> DNSDomain :
> ServiceName : e1express
> Description : Intel(R) 82566MM Gigabit Network Connection
> Index : 4
>
>
>
> ---
> Shay Levy
> Windows PowerShell MVP
> http://blogs.microsoft.co.il/blogs/ScriptFanatic
>
>
>
> p> I'm trying to find a way to list the network adapter information
> p> based on the ethernet adapter as listed by ipconfig - the 'defaults'
> p> are 'Local Area Connection', Local Area Connection 2', etc...
> p> p> I've found lots of info using Win32_NetworkAdapterConfiguration, and
> p> this gets me most of what I want. But I can't find the 'name' in
> p> this object. How do I get this name? Or is there a way I can get
> p> the NICs Win32_NetworkAdapterConfiguration object with the given
> p> name. Either will work with with I'm doing.
> p> p> Thx,
> p> p> Perry
> p>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Local area connection always lost Network & Sharing
local area connection Network & Sharing
Local Area Connection > Local Only Vista networking & sharing
Local Area Connection Problems Vista General
Local Area Connection and TCP/IP for LAN Networks Vista networking & sharing


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46