简体   繁体   中英

Failing to disable a Get-wmiobject win32_NetworkAdapter via PowerShell (dell venue 8 pro) (windows10)

I'm trying to reproduce the instructions of https://github.com/vstarostenko/dv8p_wifi_issue_fix/blob/master/README.md But while everything seems correct, the system is just not following orders (which is to disable the network adapter). It runs a windows10 system, I didn't try with the previous version.

What I've done:

  1. Open PowerShell as administrator
  2. Run "Set-ExecutionPolicy RemoteSigned"
  3. Run "Get-wmiobject win32_NetworkAdapter". Then I get that my device has an ID of 1
  4. Write and execute the script:

*Using the first line or the second doesn't make any difference

#$adapter = Get-WmiObject Win32_NetworkAdapter | where {$_.DeviceID -eq 1}
$adapter = Get-WmiObject Win32_NetworkAdapter -computerName LocalHost -filter "DeviceId = 1"
$adapter.Availability
$adapter.Disable()
$adapter.Availability

Then I get an unchanged status, precisely this

3

__GENUS          : 2
__CLASS          : __PARAMETERS
__SUPERCLASS     : 
__DYNASTY        : __PARAMETERS
__RELPATH        : 
__PROPERTY_COUNT : 1
__DERIVATION     : {}
__SERVER         : 
__NAMESPACE      : 
__PATH           : 
ReturnValue      : 0
PSComputerName   : 

3

From what I've read, this should work. What's failing?

[SOLVED] Not knowing why it doesn't work, I have done it in the following way:

Get-NetAdapter -Name Wi-Fi | fl Status
Get-NetAdapter -Name Wi-Fi | Disable-NetAdapter -Confirm:$false
Get-NetAdapter -Name Wi-Fi | fl Status
Get-NetAdapter -Name Wi-Fi | Enable-NetAdapter -Confirm:$false
Get-NetAdapter -Name Wi-Fi | fl Status

Availablity doesn't specify enabled/disabled, but if the network adapter is available, ex. not working, not enough Power, no driver(i think).

NetEnabled specifies if the network adapter is enabled/in use (will show false on enabled wifi if not Connected to network).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM