| |
| $lostDeviceIds = @() |
| .\adb.exe devices | ? { $_ -match '\bdevice\b' } | Select-String '.*(?=\t)' | ForEach-Object { ($_.Matches.Value) } | % { |
| $info = .\adb.exe -s $_ shell ' dumpsys media.camera | grep Facing ' |
| $output = "$_ $info" |
| if ( -not (($info -like '*Back*' ) -and ($info -like '*Front*' )) ) { |
| Write-Host $output -ForegroundColor Red |
| $lostDeviceIds += $_ |
| } |
| else { |
| echo $output |
| } |
| } |
| |
| echo "缺少摄像头编号" |
| |
| $lostDeviceIds | % { echo $_ } |
| |
| $lostDeviceIds = @() |
| 1..80 | |
| ForEach-Object { "10.10.104.$($_)" } | |
| ForEach-Object { |
| |
| $result = Test-Connection $_ -Count 1 -Quiet; |
| $msg = "$_ $result" |
| |
| if (-not $result) { |
| |
| Write-Host $msg -ForegroundColor Red |
| } |
| else{ |
| |
| Write-Host $msg -ForegroundColor Green |
| |
| |
| $mobileAddress = "$($_):6667" |
| adb connect $mobileAddress | Out-Null |
| |
| if(-not $?) |
| { |
| |
| Write-Host "$_ 连接失败" -ForegroundColor Red |
| } |
| else { |
| |
| |
| |
| |
| $info = adb -s $mobileAddress shell ' dumpsys media.camera | grep Facing ' |
| $output = "$_ $info" |
| |
| |
| if( -not (($info -like '*Back*' ) -and ($info -like '*Front*' )) ){ |
| Write-Host $output -ForegroundColor Red |
| $lostDeviceIds += $_ |
| } |
| else{ |
| Write-Output $output |
| } |
| |
| |
| adb disconnect $mobileAddress | Out-Null |
| } |
| } |
| |
| Write-Output "" |
| } |
| |
| Write-Output "单独输出缺少摄像头编号" |
| $lostDeviceIds | % { echo $_ } |