PowerShell/Scripts/list-bluetooth-devices.ps1

26 lines
720 B
PowerShell
Raw Normal View History

2021-12-03 12:49:05 +01:00
<#
.SYNOPSIS
2022-10-24 15:51:54 +02:00
Lists Bluetooth devices
2021-12-03 12:49:05 +01:00
.DESCRIPTION
2022-10-24 15:51:54 +02:00
This PowerShell script lists all Bluetooth devices connected to the computer.
2021-12-03 12:49:05 +01:00
.EXAMPLE
2023-08-06 21:35:36 +02:00
PS> ./list-bluetooth-devices.ps1
Status Class FriendlyName InstanceId
------ ----- ------------ ----------
OK Bluetooth Realtek Bluetooth 5.3 Adapter USB\VID_...
...
2021-12-03 12:49:05 +01:00
.LINK
https://github.com/fleschutz/PowerShell
2022-01-29 12:47:46 +01:00
.NOTES
2022-09-06 21:42:04 +02:00
Author: Markus Fleschutz | License: CC0
2021-12-03 12:49:05 +01:00
#>
try {
Get-PnpDevice | Where-Object {$_.Class -eq "Bluetooth"}
exit 0 # success
} catch {
2022-04-13 12:06:32 +02:00
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
2021-12-03 12:49:05 +01:00
exit 1
}