Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6692313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:51:13+00:00 2026-05-26T05:51:13+00:00

im tring to attach a usb device with an ID to my xp mode

  • 0

im tring to attach a usb device with an ID to my xp mode (virtual machine).
Here is the code i found on the internet.

    # Connect to Virtual PC
$vpc = new-object -comobject "VirtualPC.Application"

# Get VM name
$vmName = Read-host "Specify the name of the virtual machine that you want to use"

# List available USB devices
write-host "The following USB devices are available:"
$vpc.USBDeviceCollection | select -ExpandProperty DeviceString

# Get the USB device name
$usb = Read-host "Enter the name of the USB device that you want to connect to the virtual machine"

# Get the VM object
$vm = $vpc.findVirtualMachine($vmName)

# Get the USB object
$usbDevice = $vpc.USBDeviceCollection | ? {$_.DeviceString -eq $usb} | select -first 1

# Attach the device - this will fail if the VM is not running
$vm.AttachUSBDevice($usbDevice)

Now the following line gives the name of the device:

$vpc.USBDeviceCollection | select -ExpandProperty DeviceString

I want to see the ID of the Device. If you go to Device manager and select an “Unknown Device” -properties -details -Hardware IDs you’ll see the id of that device and i want to get this id in Powershell so i can assagin it with the device id to my VM(xp mode)

I’m pretty new to powershell, mybe there is a way to see all the properties $vpc.USBDeviceCollection but i dont know how…

Can someone help me out?
Thx!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:51:14+00:00Added an answer on May 26, 2026 at 5:51 am

    VirtualPC.Application not have a DeviceID property.

    Try read here for got it using wmi

    http://blogs.msdn.com/b/powershell/archive/2007/02/24/displaying-usb-devices-using-wmi.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to attach a function-object to be called on destruction of a
I'm trying to attach an image on a button in WPF, however this code
I am trying to attach a file with a contact form. My code looks
i'm trying to wrap a c++ library for a specific usb device in JAVA.
i am trying to attach a built context menu strip into an object which
I'm using this tickertype jquery plugin: http://www.hungry-media.com/code/jQuery/tickerType/ And I'm trying to attach a hover
I have a VS2010 running on a WTS machine (Windows2008). I'm trying to attach
Is there any way to find newly added device like usb, mouse, cd-rom etc?
I'm trying to attach two existing and one new bid bid to an existing
I'm trying to attach a PDF attachment to an email being sent with System.Net.Mail.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.