Forum Discussion
corichter
Apr 16, 2021Copper Contributor
Switch Bluetooth off and on via PowerShell
Hi, is it possible to switch Bluetooth off and on via PowerShell? I only found how to stop and start the Bluetooth service and drivers but that does not solve our issue. See picture below ...
corichter
Apr 27, 2021Copper Contributor
Hi,
thanks for the response. It does not work, I get a "Deniedbyuser" as stated also in this article:
https://superuser.com/questions/1615053/using-powershell-to-turn-on-off-the-bluetooth-script-doesnt-work
Anyone found a solution about this?
Kind regards
Cornelius
thanks for the response. It does not work, I get a "Deniedbyuser" as stated also in this article:
https://superuser.com/questions/1615053/using-powershell-to-turn-on-off-the-bluetooth-script-doesnt-work
Anyone found a solution about this?
Kind regards
Cornelius
corichter
May 18, 2021Copper Contributor
Hi,
did some more investigations on this issue.
The problem seems to be related to the Radio.RequestAccessAsync() object.
Found this C# example https://stackoverflow.com/questions/34602074/radio-requestaccessasync-only-return-deniedbyuser
How to do this in PowerShell?
Kind regards
did some more investigations on this issue.
The problem seems to be related to the Radio.RequestAccessAsync() object.
Found this C# example https://stackoverflow.com/questions/34602074/radio-requestaccessasync-only-return-deniedbyuser
How to do this in PowerShell?
Kind regards
- vivichandJun 01, 2021Copper ContributorHi All,
The solution to fix "DeniedByUser" error in this case is to add a script to change the value for registry key "LetAppsAccessRadios" to "0" in registry path HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy
Define a variable:
$RegPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy"
$RegKey = "LetAppsAccessRadios"
In script:
Set-ItemProperty -Path $RegPath -Name $RegKey -type DWORD -Value 0
Hope this helps. Thanks.
Regards,
Vivyn C R S