Adb devices | select-object -skip 1 | foreach-object -parallel {
$id=$_ -replace '\s+device'
Adb -s $id install some.apk
}
$SourcePath = "PathToYourFile"
If (Get-Item HKLM:\SOFTWARE\Policies\Microsoft\Windows\DeviceInstall\Restrictions\AllowDeviceIDs)
{
$SourceID = Get-Content $SourcePath
$idx = 1
foreach($DeviceID in $SourceID)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\DeviceInstall\Restrictions\AllowDeviceIDs -Name $idx -PropertyType String -Value $DeviceID | Out-Null
$idx++
}
}
Get-PnpDevice |
Where {$_.HardwareID -notmatch 'PRINTENUM*|ROOT*|SW*|ACPIAPIC*|MONITOR*'} |
Foreach { $_.HardwareID | Select -first 1 }