简体   繁体   English

无法通过PowerShell禁用Get-wmiobject win32_NetworkAdapter(dell场所8专业版)(windows10)

[英]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). 我正在尝试重现https://github.com/vstarostenko/dv8p_wifi_issue_fix/blob/master/README.md的说明,但是,尽管一切似乎正确,但系统并未遵循命令(即禁用网络适配器) 。 It runs a windows10 system, I didn't try with the previous version. 它运行的是Windows10系统,我没有尝试使用以前的版本。

What I've done: 我所做的:

  1. Open PowerShell as administrator 以管理员身份打开PowerShell
  2. Run "Set-ExecutionPolicy RemoteSigned" 运行“ Set-ExecutionPolicy RemoteSigned”
  3. Run "Get-wmiobject win32_NetworkAdapter". 运行“ Get-wmiobject win32_NetworkAdapter”。 Then I get that my device has an ID of 1 然后我得到我的设备的ID为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. Availablity未指定启用/禁用,但是如果网络适配器可用,例如。 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). NetEnabled指定是否启用/正在使用网络适配器(如果未连接到网络,则在启用的wifi上将显示false)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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