Link to home
Start Free TrialLog in
Avatar of BrianSDG
BrianSDGFlag for United States of America

asked on

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

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.

ASKER CERTIFIED SOLUTION
Avatar of Aard Vark
Aard Vark
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BrianSDG

ASKER

thanks, you were close.  Try;
Get-wmiobject Win32_NetworkAdapterConfiguration -Filter "IPEnabled='$True'"

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.