$____ = "----" # $BTHDevices = Get-PnpDevice $BTHDevices = Get-PnpDevice -Class "System" foreach ($Device in $BTHDevices) { $Battery = Get-PnpDeviceProperty -InstanceId $Device.InstanceId -KeyName '{104EA319-6EE2-4701-BD47-8DDBF425BBE5} 2' if ($Battery.Type -eq "Empty"){ continue } $Battery = $Battery.Data if ($Battery -eq ""){ continue } # $Conn = Get-PnpDeviceProperty -InstanceId $Device.InstanceId -KeyName '{83DA6326-97A6-4088-9453-A1923F573B29} 15' # $Conn = Get-PnpDeviceProperty -InstanceId $Device.InstanceId -KeyName 'DEVPKEY_Device_IsPresent' # if ($Conn.Type -eq "Empty"){ # $Conn=False # } # if ($Conn.Data -eq ""){ # $Conn=False # }else{ # $Conn=$Conn.Data # } # $ConnNum = 0; # if ($Conn){ # $ConnNum = 1; # } $Name = $Device.FriendlyName $Id = $Device.InstanceId if ($Battery) { $name = $Device.FriendlyName # $Message = "$Id$____$Name$____$Battery$____$ConnNum" $Message = "$Id$____$Name$____$Battery" Write-Output $Message } }