usbipd-win icon indicating copy to clipboard operation
usbipd-win copied to clipboard

[Question] Use automation dll to attach all devices that are connected+bound but not attached

Open daantimmer opened this issue 9 months ago • 1 comments

I am trying to use the automation dll (Get-UsbIpdDevice) to attach all devices that are currently connected and bound, but not attached. But I am unable to go from 'Get-UsbipdDevice' context to something that can invoke usbipd attach --wsl --hardware-id ???.

Get-UsbipdDevice | Where-Object {$_.IsConnected -and $_.IsBound -and -not $_.IsAttached} | <what do I put here to invoke> | usbipd attach --wsl --hardware-id <hardwareid from cmdlet entry/ies>

daantimmer avatar May 06 '24 13:05 daantimmer

Get-UsbipdDevice | Where-Object {$_.IsConnected -and $_.IsBound -and -not $_.IsAttached} | ForEach-Object { usbipd attach --wsl --busid $_.BusId }

dorssel avatar May 07 '24 12:05 dorssel

Thank you! This is the script I ended up with:

usbipd list

Import-Module $env:ProgramW6432'\usbipd-win\PowerShell\Usbipd.Powershell.dll'

Get-UsbipdDevice | Where-Object {$_.IsConnected -and $_.IsBound -and -not $_.IsAttached} | ForEach-Object { usbipd attach --wsl --busid $_.BusId }

daantimmer avatar May 29 '24 07:05 daantimmer