![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Active/Primary Network Adapter Is there a way to tell which NIC is "active" in a PC? I am working on writing some powershell code to sweep through my network either through AD or through a text file (haven't added that yet) to tell me which machines are using DHCP and what the IPs for them are and which if any machines are using hardcoded IPs nad Gateways and such. I have seen a few machines that the onboard nic has either stopped working and a new NIC has been installed or where someone has previously put in a secondary nic and I want to make sure I am getting the one that they are actually using. Hope that makes sense. Thanks. Tim |
My System Specs![]() |
| | #2 (permalink) | ||||||||||||
| Guest | Re: Active/Primary Network Adapter This piece of code will help you start: $NICs = Get-WMIObject Win32_NetworkAdapterConfiguration -ComputerName $comp -Filter "IPEnabled='TRUE'" foreach ($NIC in $NICs) { $NIC | select DNSHostName,DNSDomain,IPAddress,IPSubnet,DefaultIPGateway,DHCPEnabled,Description,MACAddress } The crucial part is the filter "IPEnabled='TRUE'" which will give you "alive" NICs. If NIC has more than one IP address assigned, property IPAddress will be an array of IP addresses. You can do $nic | fl * to find is there any other property that you might find helpful. -aleksandar http://powershellers.blogspot.com On May 23, 2:24*am, TimParker <tim...@xxxxxx> wrote:
| ||||||||||||
My System Specs![]() | |||||||||||||
| | #3 (permalink) | ||||||||||||
| Guest | Re: Active/Primary Network Adapter Perfect. I just ran this on my workstation at home that currently is not in a domain and got a couple errors based on that (which I expected to see) the IPEnabled is the magic field I was looking for! Thanks for the info! Tim On May 23, 3:29 am, alexandair <alexand...@xxxxxx> wrote:
| ||||||||||||
My System Specs![]() | |||||||||||||
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to index network files AND not fill your primary drive | Jesper Hauge | Vista file management | 0 | 08-26-2008 03:58 PM |
| Network Adapter Hangs When Transferring/Streaming from Network | ConFUZEd Wulf | Network & Internet | 12 | 07-05-2008 08:25 PM |
| two active network connections | mokeur | Vista networking & sharing | 6 | 05-19-2008 04:19 PM |
| What partition becomes the Active one by default on the primary di | Henrik | Vista installation & setup | 0 | 02-04-2008 01:40 AM |
| 3Com Wireless adapter not active | JW | Vista hardware & devices | 2 | 08-17-2007 10:48 PM |