Skip to content

Instantly share code, notes, and snippets.

@Diom
Last active May 5, 2017 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Diom/79e7f27aa0ee32ae7aa146d26968487f to your computer and use it in GitHub Desktop.
Save Diom/79e7f27aa0ee32ae7aa146d26968487f to your computer and use it in GitHub Desktop.
Powershell VBoxManage List USBHost Covert To Object Array
$allUsbDevs = vboxmanage list usbhost | Out-String | %{$_ -replace ':','=' } | %{$_ -split '(?=UUID)'} | ConvertFrom-StringData | where{ $_.UUID -ne $null }
$uuidToUse = vboxmanage list usbhost | Out-String | %{$_ -replace ':','=' } | %{$_ -split '(?=UUID)'} | ConvertFrom-StringData | where{ $_.Product -eq "USB DISK 2.0"} | %{$_.UUID}
@Diom
Copy link
Author

Diom commented May 5, 2017

Trying to automate USB device attachments to a VirtualBox machine? Need to find the correct UUID for a device?
This gist converts the output of vboxmanage list usbhost into an array of objects. These can then be filtered by their properties, to exclude items which are already "captured" and to pick a device by name or manufacturer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment