PowerShell/Scripts/list-bluetooth-devices.ps1

21 lines
448 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
PS> ./list-bluetooth-devices
.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
}