Do { Start-Sleep -Seconds 15 $ListAllDevice = "Get the list of all paired Bluetooth Device" $DeviceStatus = $ListAllDevice | Get-ItemProperty $DeviceDetection = ($DeviceStatus).DeviceState ForEach($IndDetection in $DeviceDetection) { If($IndDetection -eq 1) { Write-Host "device detected." } Else { rundll32.exe user32.dll,LockWorkStation } } } While((Get-Date).hour -le 18)
(Get-Device | Where-Object {$_.Name -like '*Lenovo*'}).NodeStatus
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)