Go Premium for a chance to win a PS4. Enter to Win

x
?
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
?
781 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 18

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 18

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

Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

Question has a verified solution.

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

Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Loops Section Overview
Suggested Courses

782 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