Server 2012, Powershell 3.0.
I'm doing some work that requires automating the enabling and disabling of network adapters. Here is an example of what I see when I run Get-NetAdapter
:
Name InterfaceDescription ifIndex Status MacAddress LinkSpeed
---- -------------------- ------- ------ ---------- ---------
Slot 0 Port 4 HP NC382i DP Multifunction Gigabi...#53 15 Not Present 11-80-1B-94-2A-82 0 bps
Slot 0 Port 2 (TM-2) HP NC382i DP Multifunction Gigabi...#51 14 Up 11-80-1B-94-27-72 1 Gbps
Team 1 (Team) Microsoft Network Adapter Multiplexo... 17 Up 11-80-1B-94-2A-72 1 Gbps
Slot 0 Port 3 HP NC382i DP Multifunction Gigabi...#52 13 Disabled 11-80-1B-94-2A-80 1 Gbps
Slot 0 Port 1 (TM-1) HP NC382i DP Multifunction Gigabi...#50 12 Up 11-80-1B-94-2A-70 1 Gbps
Notice that the Status attribute is not binary. It could be Up, Disabled, or Not Present.
When I run Enable-NetAdapter
on a NIC whose status is 'Not Present,' the command silently returns, no error output, but it does not enable the NIC. I then enabled the NIC manually by right-clicking its icon in the Control Panel and choosing Enable. Its status was now Enabled with a Status of Up.
Then I ran Disable-NetAdapter
on the NIC. Its status was now 'Disabled.'
Now, the Enable-NetAdapter
Cmdlet worked as expected and turns the NIC on.
- So what was 'Not Present' and why did Powershell fail to enable the NIC when it was in that state, but I had no problems enabling it via the GUI, but now it seems to only flip back and forth between Enabled and Disabled?
- How do I get 'Not Present' back if I wanted to?
- How do I enable a NIC with Powershell when it's in a 'Not Present' state?