【发布时间】:2018-12-09 16:02:19
【问题描述】:
几天前我问了这个问题, How to connect and remove bluetooth in windows powerhell,但每当我尝试运行代码时:
$device = Get-PnpDevice | Where-Object {$_.Class -eq "Bluetooth" -and $_.FriendlyName -eq "MX Master 2S"}
Disable-PnpDevice -InstanceId $device.InstanceId -Confirm:$false
Start-Sleep -Seconds 10
Enable-PnpDevice -InstanceId $device.InstanceId -Confirm:$false
我得到这个错误:
Disable-PnpDevice : Generic failure At C:\Users\wadeb\OneDrive\Desktop\Mouse Bluetooth Reset.ps1:2 char:1 + Disable-PnpDevice -InstanceId $device.InstanceId -Confirm:$false + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (Win32_PnPEntity...B17A1&0&FAD...):ROOT\cimv2\Win32_PnPEntity) [ Disable-PnpDevice], CimException + FullyQualifiedErrorId : HRESULT 0x80041001,Disable-PnpDevice
我以提升的权限运行它,enable-pnpdevice 没有错误代码,只有 disable-pnpdevice 有问题。
有人知道怎么做吗? 在保罗的评论之后,我仔细检查了我是否在管理员中,我不是,但是当我这样做时,现在弹出:
禁用-PnpDevice:不支持 在行:2 字符:1 + 禁用-PnpDevice -InstanceId $device.InstanceId -Confirm:$false + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ + CategoryInfo : 未实现: (Win32_PnPEntity...B17A1&0&FAD...):ROOT\cimv2\Win32_PnPEntity) [禁用-PnpDevice],CimException + FullyQualifiedErrorId : HRESULT 0x8004100c,Disable-PnpDevice
还有,我跑了
$device
Status Class FriendlyName InstanceId
------ ----- ------------ ----------
OK Bluetooth MX Master 2S BTHLE\DEV_FA...
不确定这是否是保罗所说的包含的意思。
过了一会儿,在 Paul 帮助我聊天时,我们确定我的蓝牙芯片或实际软件有问题,所以如果有人对此有任何想法,将不胜感激。
【问题讨论】:
-
评论不用于扩展讨论;这个对话是moved to chat。
标签: powershell bluetooth plug-and-play