PowerShell Enable-NetAdapter

How to Enable a Network Adapter with PowerShell 3.0Enable-NetAdapter

With PowerShell 3.0 it’s straightforward to enable a NIC (Network Interface Card), just use a built-in CIM cmdlet called Enable-NetAdapter.

Tutorial to Enable (or Disable) a NIC

 ♣

Scenarios for Enabling a Network Adapter

Many scenarios for controlling a network adapter focus on Wi-Fi.  However, there maybe other situations where a computers has multiple NICs and you want to choose which one is active.

When grappling with NIC settings, Windows PowerShell v 3.0 offers an easier alternativeto ‘Netsh’ commands such as:
Netsh interface set interface <NIC Name> Enabled

The only problem with PowerShell’s Enable-NetAdapter is that you need to know the Name of your NIC.  This is where the cmdlet Get-NetAdapter is a useful precursor.

Research the Names of Your NICs

# PowerShell script to list your network cards.
Get-NetAdapter | FT Name, InterfaceDescription -Auto

Note 1:  You can find more properties by appending | Get-Member.

How to Enable a Named Network Card

Preliminary step: before you launch PowerShell, right-click and ‘Run as Administrator’.

# PowerShell script to enable one of your NICs.
Enable-NetAdapter -Name ‘Wi-Fi’

Note 2:  You may need to change the name ‘Wi-Fi’ for the name of your network card, as revealed by research with Get-NetAdapter.

Guy Recommends:  A Free Trial of the Network Performance Monitor (NPM)Review of Orion NPM v11.5 v11.5

SolarWinds’ Network Performance Monitor will help you discover what’s happening on your network.  This utility will also guide you through troubleshooting; the dashboard will indicate whether the root cause is a broken link, faulty equipment or resource overload.

What I like best is the way NPM suggests solutions to network problems.  Its also has the ability to monitor the health of individual VMware virtual machines.  If you are interested in troubleshooting, and creating network maps, then I recommend that you try NPM now.

Download a free trial of Solarwinds’ Network Performance Monitor

How to Disabled Your Network CardDisable-NetAdapter

For testing purposes you may wish to ‘Disable’ the network card, and thus reverse the effect of Enable-NetAdapter.

# PowerShell script to disable your network card.
$YourNic = ‘Wi-Fi’
Disable-NetAdapter -Name $YourNic

Note 3:  Remember this: before you launch PowerShell 3.0 ISE, right-click and Run as Administrator.

More Members of Microsoft’s NetAdapter Family

Once you have found a useful PowerShell cmdlet it’s always worth researching it’s sister commands; who knows, you may find an even better cmdlet.

Get-Command -Noun netadapter

CommandType  Name            ModuleName
———–         ——            ————
Function Disable-NetAdapter  NetAdapter
Function Enable-NetAdapter   NetAdapter
Function Get-NetAdapter        NetAdapter
Function Rename-NetAdapter NetAdapter
Function Restart-NetAdapter   NetAdapter
Function Set-NetAdapter        NetAdapter

Guy Recommends:  SolarWinds’ Free Bulk Import ToolFree Download Solarwinds Bulk Import Tool

Import users from a spreadsheet.  Just provide a list of the users with their fields in the top row, and save as .csv file.  Then launch this FREE utility and match your fields with AD’s attributes, click and import the users.

Optionally, you can provide the name of the OU where the new accounts will be born. Download your FREE bulk import tool.

If you need more comprehensive application analysis software,
Download a free trial of SAM (Server & Application Monitor)

Getting Started With PowerShell v 3.0Disable-NetAdapter

  • Launch PowerShell (Preferably the ISE version)
  • Copy the lines of code in the above examples (into memory).
  • Right-click in the top pane.
  • Paste.

More PowerShell v 3.0 Networking Cmdlets

One way to discover more about the new version 3 cmdlets is once the ISE has launched, look at the ‘Modules’ in the Commands pane. 

See more examples of PowerShell v 3.0 NetAdapter cmdlets »

Summary of PowerShell Enable-NetAdapter Cmdlet

PowerShell 3.0 introduces new cmdlets to manipulate NICs.  This page shows you how easy it is to enable a Wi-Fi network card with Enable-NetAdapter.

If you like this page then please share it with your friends

 


See more Microsoft PowerShell v 3.0 examples

PowerShell 3.0  • What’s New in PowerShell 3.0  • PowerShell v 3.0 ISE  • PowerShell Home

Get-NetAdapter  • Disable-NetAdapter  • Enable-NetAdapter  • Get-NetIPConfiguration

PowerShell Network Cmdlets  • PowerShell 3.0 Logon Script  • PowerShell Show-Command