Solved

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

Posted on 2010-09-18
3
774 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
  • 2
3 Comments
 
LVL 17

Accepted Solution

by:
Learnctx earned 500 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Utilizing an array to gracefully append to a list of EmailAddresses
In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 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