?
Solved

How do I test to see if a NIC is enabled or disabled with a powershell script?

Posted on 2010-09-18
3
Medium Priority
?
779 Views
Last Modified: 2012-05-10
How do I test to see if a NIC is enabled or disabled with a powershell script?  Any ping type solutions like Test-Connection will not work.  The script has to be able to ascertain that property from the NIC.  Or use some algorithm that doesn't require any knowledge of anything outside the servers own system.

0
Comment
Question by:BrianSDG
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 17

Accepted Solution

by:
Learnctx earned 1500 total points
ID: 33709835
I'm assuming you're running this locally on the device? If so.
get-wmiobject win32_networkadapter -Filter "NetEnabled='$true'"

Open in new window

0
 

Author Closing Comment

by:BrianSDG
ID: 33710063
thanks, you were close.  Try;
Get-wmiobject Win32_NetworkAdapterConfiguration -Filter "IPEnabled='$True'"

0
 
LVL 17

Expert Comment

by:Learnctx
ID: 33710410
Well it all depends on what you're looking for :)

get-wmiobject win32_networkadapter -Filter "NetEnabled='$true'"

This will find network adapters which are disabled (that is, a disabled device in Windows by right clicking the adapter and disabling/enabling it).

Get-wmiobject Win32_NetworkAdapterConfiguration -Filter "IPEnabled='$True'"

This will look for network adapters which do not have IPv4 or IPv6 protocols in use.
0

Featured Post

Four New Appliances. Same Industry-leading Speeds.

But don't take it from us.  The Firebox M370 is Miercom tested and Miercom approved, outperforming its competitors for stateless and stateful traffic throughput scenarios.  Learn more about the M370, M470, M570 and M670 and find the right solution for your organization today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
There are times when we need to generate a report on the inbox rules, where users have set up forwarding externally in their mailbox. In this article, I will be sharing a script I wrote to generate the report in CSV format.
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question