How to toggle Win10 bluetooth off and on at startup
I have a Win10 laptop that I move back and forth between home and work. I use identical-but-separate bluetooth mice at each location. Each time I switch locations (and thus switch bluetooth mice), I must go into Settings to toggle of, and back on again, the bluetooth "switch" to make the laptop connect to the new mouse (even though it shows up as already "paired" in the list of bluetooth devices). Note this is the case even across reboots.
Of course my first thought to automate this process was to just use a script to bounce the bluetooth service(s) at boot time to emulate the turning off and back on again the bluetooth switch in the Settings page. But it seems I'm failing to identify the right service (if in fact that is the right approach) to toggle. I've used powershell to stop "bthserv" and "ibtsiva", but my mouse is still happily working fine, so obviously that is not equivalent to turning "off" the bluetooth switch.
PS C:WINDOWSsystem32> get-service -DisplayName *Bluetooth*
Status Name DisplayName
------ ---- -----------
Stopped BluetoothUserSe... Bluetooth User Support Service_3b07...
Stopped BTAGService Bluetooth Audio Gateway Service
Stopped bthserv Bluetooth Support Service
Stopped ibtsiva Intel Bluetooth Service
Is there some other service I should be toggling? Or is the service just completely the wrong approach? Forcing the hardware to shut down and start again works every time, so it definitely includes whatever action I need to do. I just need to find a way to automate it. Any pointers?
powershell bluetooth
add a comment |
I have a Win10 laptop that I move back and forth between home and work. I use identical-but-separate bluetooth mice at each location. Each time I switch locations (and thus switch bluetooth mice), I must go into Settings to toggle of, and back on again, the bluetooth "switch" to make the laptop connect to the new mouse (even though it shows up as already "paired" in the list of bluetooth devices). Note this is the case even across reboots.
Of course my first thought to automate this process was to just use a script to bounce the bluetooth service(s) at boot time to emulate the turning off and back on again the bluetooth switch in the Settings page. But it seems I'm failing to identify the right service (if in fact that is the right approach) to toggle. I've used powershell to stop "bthserv" and "ibtsiva", but my mouse is still happily working fine, so obviously that is not equivalent to turning "off" the bluetooth switch.
PS C:WINDOWSsystem32> get-service -DisplayName *Bluetooth*
Status Name DisplayName
------ ---- -----------
Stopped BluetoothUserSe... Bluetooth User Support Service_3b07...
Stopped BTAGService Bluetooth Audio Gateway Service
Stopped bthserv Bluetooth Support Service
Stopped ibtsiva Intel Bluetooth Service
Is there some other service I should be toggling? Or is the service just completely the wrong approach? Forcing the hardware to shut down and start again works every time, so it definitely includes whatever action I need to do. I just need to find a way to automate it. Any pointers?
powershell bluetooth
You could tryGet-Service -DisplayName *Bluetooth* | Restart-Service
. You might also try the Radio Management Service.
– harrymc
Dec 6 at 16:32
add a comment |
I have a Win10 laptop that I move back and forth between home and work. I use identical-but-separate bluetooth mice at each location. Each time I switch locations (and thus switch bluetooth mice), I must go into Settings to toggle of, and back on again, the bluetooth "switch" to make the laptop connect to the new mouse (even though it shows up as already "paired" in the list of bluetooth devices). Note this is the case even across reboots.
Of course my first thought to automate this process was to just use a script to bounce the bluetooth service(s) at boot time to emulate the turning off and back on again the bluetooth switch in the Settings page. But it seems I'm failing to identify the right service (if in fact that is the right approach) to toggle. I've used powershell to stop "bthserv" and "ibtsiva", but my mouse is still happily working fine, so obviously that is not equivalent to turning "off" the bluetooth switch.
PS C:WINDOWSsystem32> get-service -DisplayName *Bluetooth*
Status Name DisplayName
------ ---- -----------
Stopped BluetoothUserSe... Bluetooth User Support Service_3b07...
Stopped BTAGService Bluetooth Audio Gateway Service
Stopped bthserv Bluetooth Support Service
Stopped ibtsiva Intel Bluetooth Service
Is there some other service I should be toggling? Or is the service just completely the wrong approach? Forcing the hardware to shut down and start again works every time, so it definitely includes whatever action I need to do. I just need to find a way to automate it. Any pointers?
powershell bluetooth
I have a Win10 laptop that I move back and forth between home and work. I use identical-but-separate bluetooth mice at each location. Each time I switch locations (and thus switch bluetooth mice), I must go into Settings to toggle of, and back on again, the bluetooth "switch" to make the laptop connect to the new mouse (even though it shows up as already "paired" in the list of bluetooth devices). Note this is the case even across reboots.
Of course my first thought to automate this process was to just use a script to bounce the bluetooth service(s) at boot time to emulate the turning off and back on again the bluetooth switch in the Settings page. But it seems I'm failing to identify the right service (if in fact that is the right approach) to toggle. I've used powershell to stop "bthserv" and "ibtsiva", but my mouse is still happily working fine, so obviously that is not equivalent to turning "off" the bluetooth switch.
PS C:WINDOWSsystem32> get-service -DisplayName *Bluetooth*
Status Name DisplayName
------ ---- -----------
Stopped BluetoothUserSe... Bluetooth User Support Service_3b07...
Stopped BTAGService Bluetooth Audio Gateway Service
Stopped bthserv Bluetooth Support Service
Stopped ibtsiva Intel Bluetooth Service
Is there some other service I should be toggling? Or is the service just completely the wrong approach? Forcing the hardware to shut down and start again works every time, so it definitely includes whatever action I need to do. I just need to find a way to automate it. Any pointers?
powershell bluetooth
powershell bluetooth
asked Dec 6 at 14:01
Jimbo1987
31
31
You could tryGet-Service -DisplayName *Bluetooth* | Restart-Service
. You might also try the Radio Management Service.
– harrymc
Dec 6 at 16:32
add a comment |
You could tryGet-Service -DisplayName *Bluetooth* | Restart-Service
. You might also try the Radio Management Service.
– harrymc
Dec 6 at 16:32
You could try
Get-Service -DisplayName *Bluetooth* | Restart-Service
. You might also try the Radio Management Service.– harrymc
Dec 6 at 16:32
You could try
Get-Service -DisplayName *Bluetooth* | Restart-Service
. You might also try the Radio Management Service.– harrymc
Dec 6 at 16:32
add a comment |
1 Answer
1
active
oldest
votes
See this Q&A …
Turn on/off Bluetooth radio/adapter from cmd/powershell in Windows 10
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$true)][ValidateSet('Off', 'On')][string]$BluetoothStatus
)
If ((Get-Service bthserv).Status -eq 'Stopped')
{ Start-Service bthserv }
Add-Type -AssemblyName System.Runtime.WindowsRuntime
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() `
| ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0]
Function Await($WinRtTask, $ResultType)
{
$asTask = $asTaskGeneric.MakeGenericMethod($ResultType)
$netTask = $asTask.Invoke($null, @($WinRtTask))
$netTask.Wait(-1) | Out-Null
$netTask.Result
}
[Windows.Devices.Radios.Radio,Windows.System.Devices,ContentType=WindowsRuntime] | Out-Null
[Windows.Devices.Radios.RadioAccessStatus,Windows.System.Devices,ContentType=WindowsRuntime] | Out-Null
Await ([Windows.Devices.Radios.Radio]::RequestAccessAsync()) ([Windows.Devices.Radios.RadioAccessStatus]) | Out-Null
$radios = Await ([Windows.Devices.Radios.Radio]::GetRadiosAsync()) ([System.Collections.Generic.IReadOnlyList[Windows.Devices.Radios.Radio]])
$bluetooth = $radios | ? { $_.Kind -eq 'Bluetooth' }
[Windows.Devices.Radios.RadioState,Windows.System.Devices,ContentType=WindowsRuntime] | Out-Null
Await ($bluetooth.SetStateAsync($BluetoothStatus)) ([Windows.Devices.Radios.RadioAccessStatus]) | Out-Null
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1381354%2fhow-to-toggle-win10-bluetooth-off-and-on-at-startup%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
See this Q&A …
Turn on/off Bluetooth radio/adapter from cmd/powershell in Windows 10
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$true)][ValidateSet('Off', 'On')][string]$BluetoothStatus
)
If ((Get-Service bthserv).Status -eq 'Stopped')
{ Start-Service bthserv }
Add-Type -AssemblyName System.Runtime.WindowsRuntime
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() `
| ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0]
Function Await($WinRtTask, $ResultType)
{
$asTask = $asTaskGeneric.MakeGenericMethod($ResultType)
$netTask = $asTask.Invoke($null, @($WinRtTask))
$netTask.Wait(-1) | Out-Null
$netTask.Result
}
[Windows.Devices.Radios.Radio,Windows.System.Devices,ContentType=WindowsRuntime] | Out-Null
[Windows.Devices.Radios.RadioAccessStatus,Windows.System.Devices,ContentType=WindowsRuntime] | Out-Null
Await ([Windows.Devices.Radios.Radio]::RequestAccessAsync()) ([Windows.Devices.Radios.RadioAccessStatus]) | Out-Null
$radios = Await ([Windows.Devices.Radios.Radio]::GetRadiosAsync()) ([System.Collections.Generic.IReadOnlyList[Windows.Devices.Radios.Radio]])
$bluetooth = $radios | ? { $_.Kind -eq 'Bluetooth' }
[Windows.Devices.Radios.RadioState,Windows.System.Devices,ContentType=WindowsRuntime] | Out-Null
Await ($bluetooth.SetStateAsync($BluetoothStatus)) ([Windows.Devices.Radios.RadioAccessStatus]) | Out-Null
add a comment |
See this Q&A …
Turn on/off Bluetooth radio/adapter from cmd/powershell in Windows 10
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$true)][ValidateSet('Off', 'On')][string]$BluetoothStatus
)
If ((Get-Service bthserv).Status -eq 'Stopped')
{ Start-Service bthserv }
Add-Type -AssemblyName System.Runtime.WindowsRuntime
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() `
| ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0]
Function Await($WinRtTask, $ResultType)
{
$asTask = $asTaskGeneric.MakeGenericMethod($ResultType)
$netTask = $asTask.Invoke($null, @($WinRtTask))
$netTask.Wait(-1) | Out-Null
$netTask.Result
}
[Windows.Devices.Radios.Radio,Windows.System.Devices,ContentType=WindowsRuntime] | Out-Null
[Windows.Devices.Radios.RadioAccessStatus,Windows.System.Devices,ContentType=WindowsRuntime] | Out-Null
Await ([Windows.Devices.Radios.Radio]::RequestAccessAsync()) ([Windows.Devices.Radios.RadioAccessStatus]) | Out-Null
$radios = Await ([Windows.Devices.Radios.Radio]::GetRadiosAsync()) ([System.Collections.Generic.IReadOnlyList[Windows.Devices.Radios.Radio]])
$bluetooth = $radios | ? { $_.Kind -eq 'Bluetooth' }
[Windows.Devices.Radios.RadioState,Windows.System.Devices,ContentType=WindowsRuntime] | Out-Null
Await ($bluetooth.SetStateAsync($BluetoothStatus)) ([Windows.Devices.Radios.RadioAccessStatus]) | Out-Null
add a comment |
See this Q&A …
Turn on/off Bluetooth radio/adapter from cmd/powershell in Windows 10
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$true)][ValidateSet('Off', 'On')][string]$BluetoothStatus
)
If ((Get-Service bthserv).Status -eq 'Stopped')
{ Start-Service bthserv }
Add-Type -AssemblyName System.Runtime.WindowsRuntime
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() `
| ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0]
Function Await($WinRtTask, $ResultType)
{
$asTask = $asTaskGeneric.MakeGenericMethod($ResultType)
$netTask = $asTask.Invoke($null, @($WinRtTask))
$netTask.Wait(-1) | Out-Null
$netTask.Result
}
[Windows.Devices.Radios.Radio,Windows.System.Devices,ContentType=WindowsRuntime] | Out-Null
[Windows.Devices.Radios.RadioAccessStatus,Windows.System.Devices,ContentType=WindowsRuntime] | Out-Null
Await ([Windows.Devices.Radios.Radio]::RequestAccessAsync()) ([Windows.Devices.Radios.RadioAccessStatus]) | Out-Null
$radios = Await ([Windows.Devices.Radios.Radio]::GetRadiosAsync()) ([System.Collections.Generic.IReadOnlyList[Windows.Devices.Radios.Radio]])
$bluetooth = $radios | ? { $_.Kind -eq 'Bluetooth' }
[Windows.Devices.Radios.RadioState,Windows.System.Devices,ContentType=WindowsRuntime] | Out-Null
Await ($bluetooth.SetStateAsync($BluetoothStatus)) ([Windows.Devices.Radios.RadioAccessStatus]) | Out-Null
See this Q&A …
Turn on/off Bluetooth radio/adapter from cmd/powershell in Windows 10
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$true)][ValidateSet('Off', 'On')][string]$BluetoothStatus
)
If ((Get-Service bthserv).Status -eq 'Stopped')
{ Start-Service bthserv }
Add-Type -AssemblyName System.Runtime.WindowsRuntime
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() `
| ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0]
Function Await($WinRtTask, $ResultType)
{
$asTask = $asTaskGeneric.MakeGenericMethod($ResultType)
$netTask = $asTask.Invoke($null, @($WinRtTask))
$netTask.Wait(-1) | Out-Null
$netTask.Result
}
[Windows.Devices.Radios.Radio,Windows.System.Devices,ContentType=WindowsRuntime] | Out-Null
[Windows.Devices.Radios.RadioAccessStatus,Windows.System.Devices,ContentType=WindowsRuntime] | Out-Null
Await ([Windows.Devices.Radios.Radio]::RequestAccessAsync()) ([Windows.Devices.Radios.RadioAccessStatus]) | Out-Null
$radios = Await ([Windows.Devices.Radios.Radio]::GetRadiosAsync()) ([System.Collections.Generic.IReadOnlyList[Windows.Devices.Radios.Radio]])
$bluetooth = $radios | ? { $_.Kind -eq 'Bluetooth' }
[Windows.Devices.Radios.RadioState,Windows.System.Devices,ContentType=WindowsRuntime] | Out-Null
Await ($bluetooth.SetStateAsync($BluetoothStatus)) ([Windows.Devices.Radios.RadioAccessStatus]) | Out-Null
answered Dec 7 at 0:02
postanote
92023
92023
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1381354%2fhow-to-toggle-win10-bluetooth-off-and-on-at-startup%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You could try
Get-Service -DisplayName *Bluetooth* | Restart-Service
. You might also try the Radio Management Service.– harrymc
Dec 6 at 16:32