Guy recommends :
Free SolarWinds
VM Console

Solarwinds VM Console Free Download

Find out which of your VMs are a waste of space and which VMs need more resources.



PowerShell Disable-NetAdapter

PowerShell v 3.0 Disable Network AdapterDisable-NetAdapter

PowerShell version 3 makes it easier than ever to control your NIC (Network Interface Card) with Enable and Disable-NetAdapter cmdlets.

Tutorial for Disable-NetAdapter

 ♣

Scenarios for PowerShell's Disable-NetAdapter

There are scenarios where you would need to disable a network adapter, for example controlling Wi-Fi usage.  On the other hand, there are situations where your computer has multiple NICs and you want to choose which one is active.

Windows PowerShell v 3.0 offers an easier, more versatile alternative to grappling with 'Netsh' at the command line: Netsh interface set interface <NIC Name> Disabled

The only problem with PowerShell's Disable-NetAdapter is that you need to know the Name of your NIC.  This is where the sister cmdlet Get-NetAdapter is handy.

Discover the Names of Your NICs

# PowerShell script to enumerate your network cards.
Get-NetAdapter | Format-Table Name, InterfaceDescription -Auto

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

How to Disable One of Your Network Cards

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

# PowerShell script to disable your network cards.
Disable-NetAdapter -Name 'Wi-Fi'

Note 2:  Most likely you need to change the name 'Wi-Fi' for the name of your network card revealed by the Discover script above.

Note 3:  You can omit the -Name parameter as PowerShell v 3.0 assumes that the word after NetAdapter is indeed the name of the NIC.

Guy Recommends: A Free Wake-On-LAN UtilitySolarwinds Wake-On-LAN

Encouraging computers to sleep when not in use is a great idea - until you are away from your desk and need a file on that remote sleeping machine!

Wake-On-LAN really will save you that long walk to awaken a hibernating machine; however my reason for encouraging you to download this utility is just because it's so much fun sending those 'Magic Packets'.  As Wake-On-LAN (WOL) is free, see if I am right, and you get a kick from arousing those sleeping machines.  WOL also has business uses for example, wakening machines so that they can have their patches applied. 

Download your free copy of Wake-On-LAN

Enable Your Disabled Network CardDisable-NetAdapter

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

# PowerShell script to enable your network card.
$YourNic = 'Wi-Fi'
Enable-NetAdapter -Name $YourNic
Restart-NetAdapter -Name $YourNic

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

Research Microsoft's NetAdapter Cmdlet Family

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 of 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 to import the users.  Optionally, you can provide the name of the OU where the new accounts will be born.

There are also two bonus tools in this free download, and all 3 have been approved by Microsoft:

  1. Bulk-import new users into Active Directory.
  2. Seek and zap unwanted user accounts.
  3. Find inactive computers.

Download your FREE bulk import tool.

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 look at the 'Modules' in the Commands pane,  once the ISE has launched.

See more examples of PowerShell v 3.0 NetAdapter cmdlets ยป

Summary of PowerShell Disable-NetAdapter

PowerShell version 3 brings hundreds of new cmdlets.  If you research the NetAdapter noun then you will see a family of Get, Enable and Disable-NetAdapter cmdlets.

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

 


See more Microsoft PowerShell v 3.0 examples

PowerShell Tutorials  • What's New in PowerShell 3.0  • PowerShell v 3.0 ISE

PowerShell 3.0  • Disable-NetAdapter  • Disable-NetAdapter  • Enable-NetAdapter

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

 *


Custom Search

Site Home

Guy Recommends: WMI Monitor and It's Free!Solarwinds WMI Monitor

Windows Management Instrumentation (WMI) is one of the hidden treasures of Microsoft operating systems.

Fortunately, SolarWinds have created the Free WMI Monitor so that you can actually see and understand these gems of performance information.  Take the guess work out of which WMI counters to use for applications like Microsoft Active Directory, SQL or Exchange Server.

Download your free copy of WMI Monitor

Author: Guy Thomas Copyright © 1999-2012 Computer Performance LTD All rights reserved.

Please report a broken link, or an error to: