Getting Network Adapter Settings

Share |

Join PowerShell.com!
Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Award-winning PowerShellPlus


Admin Guide to PowerShell Remoting


Mastering PowerShell eBook

To view the configuration details of a network adapter, you can specify the network adapter connection ID as it appears in your control panel.  By linking the WMI result to the corresponding Win32_NetworkAdapterConfiguration class, you get to the actual configuration.

NOTE: Change the adapter name in $adapterid to some adapter name that actually exists on your machine.

$adapterid = 'Local Area Network'
$nic = Get-WmiObject Win32_NetworkAdapter -Filter "NetConnectionID='$adapterid'"
$nicconfig = $nic.GetRelated('Win32_NetworkAdapterConfiguration')
$nic
$nicconfig

 

Twitter This Tip! ReTweet this Tip!


Posted Jul 28 2011, 06:00 AM by ps1

Comments

cantoris wrote re: Getting Network Adapter Settings
on 07-28-2011 12:09 PM

Where does .GetRelated() come from, as if I pipe $nic to get-member, I can't see any such method.  Thanks.

Richard Giles wrote re: Getting Network Adapter Settings
on 07-28-2011 9:52 PM

This article by Richard Siddaway explains what you need to know:

richardspowershellblog.wordpress.com/.../powershell-deep-dive-v-wmi-associations

cantoris wrote re: Getting Network Adapter Settings
on 07-29-2011 2:41 AM

Thanks!

Copyright 2012 PowerShell.com. All rights reserved.