This blog explains how to verify network adapter is enabled or disabled in Windows machine using a PowerShell script.
Following is the look up values for net connection status for Disconnected and Connected.
Disconnected |
0 |
Connected |
2 |
Execute following command to verify network adapter is enabled or disabled. If adapter is enabled, it will return True as the result.
(get-wmiobject win32_networkadapter -filter "netconnectionid = '<<net adapter>>'"|select netconnectionstatus).netconnectionstatus -eq 2
No comments:
Post a Comment