Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to deactivate and then activate my wlan adapter via powershell. I already queried the Hardware-ID of the device. My script looks like this:

$wireless = Get-WmiObject win32_networkadapter | where {$_.DeviceId -eq 12}
Start-Sleep -s 1

But when I run the script it throws no error. But the wlan-connection keeps established. I'm pretty sure it's the right hardware-ID (I only have one device from Intel, and that's my wireless lan device).

I already googled the problem, but couldn't solve it :-/ Happy for any help! Thanks! Tobi

share|improve this question
up vote 2 down vote accepted

In some situations like this i recommend don't reinvent the wheel. Windows has for years the command netsh, you could use for this task:

Disable the adapter:

netsh interface set interface "The Name of your Wireless Adapter" Disabled

Enable the adapter:

netsh interface set interface "The Name of your Wireless Adapter" Enable

don't forget to run them as admin

share|improve this answer
I had to enter the line "netsh interface set interface name = "NameOfMyInterface" admin=enable. When no authenticated as an admin, netsh will return that the requested interface doesn't exist insted of an errormessage like "no permission". Tanks for you help! – Tobi Feb 4 '11 at 0:14

One possible explanation is that the PowerShell scripts does not have Administrator access.

For more info see also Windows Network adaptor disable enable via Powershell.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .