Sunday, 28 July 2013

Make USB devices accessible to a Windows XP virtual machine


Over the past several weeks I have written a series of articles on working with Windows 8's Client Hyper-V with the aim of establishing a working Windows XP environment that will allow migrating users to have something to fall back on as they get used to Windows 8. For your convenience, those articles are listed here:
  • Get started with Windows 8 Client Hyper-V the right way
  • Create a virtual switch in Windows 8 Client Hyper-V
  • Create a Client Hyper-V virtual machine for Windows xp
In the most recent article, I walked you through the steps of creating a virtual machine onto which you would install Windows XP. As you may have noticed while working through the New Virtual Machine Wizard and examining the virtual machine Settings window, shown in Figure A, there was no mention of USB connections. Well, that's because, unfortunately, Client Hyper-V doesn't provide native support for USB connections.

Figure A

Fig A 7-26.png
The Settings window doesn't contain any reference to USB devices.
While the lack of USB support in Hyper-V is definitely a huge shortcoming, it's actually by design. That may come as a shock, but the fact is that USB support is not available in Hyper-V Server, because it is incompatible with certain key features, such as Live Migration. Unfortunately, the lack of USB support was passed down to Windows 8's Client Hyper-V.

Filling the gap

As you can imagine, a number of third-party solutions have sprung up to fill the gap. For example, there are software products, such as USB Redirector, and hardware products like the Network-attached USB hubs. However, when it comes to using Windows 8's Client Hyper-V and a Windows XP virtual machine, you don't have to resort to such elaborate or expensive methods of making USB devices accessible to a virtual machine.
Instead, you can employ a little trick that uses the Remote Desktop Connection tool to connect to a networked virtual machine running in Client Hyper-V. You can then use the features on the Local Resources tab of a Remote Desktop Connection to redirect USB devices connected to the host machine, such as USB drives and USB printers, to the virtual machine. While on the surface this may sound like a quirky workaround, in actuality it brings with it host of benefits besides the access to USB. For example, you get a full screen display, slightly better performance, and you can use the clipboard to copy and paste data between the host and virtual machines.
In this article, I'll walk you through the steps you need to perform in order to make your Windows XP virtual machine accessible through Remote Desktop Connection. I'll then show you how to configure and access USB devices connected to the Windows 8 host machine from within your Windows XP virtual machine.

Network configuration

The first thing that you need to do in order to be able to use Remote Desktop Connection to access a virtual machine, is make sure that both the host machine and the virtual machine are configured to use the exact same workgroup. Let's take a closer look.
On the Windows 8 host machine, press [Windows]+[Break] to bring up the System window shown in Figure B. If you haven't specified a workgroup name or wish to change your computer name, you can click Change settings and use the Change button on the System Properties Computer Name tab. Keep in mind that you will be prompted to Restart the system if you change the computer name or the workgroup name. As you can see, on my example system, the computer name is Jovian-8 and the workgroup is SOLAR SYSTEM.

Figure B

Fig B 7-26.png
From Windows 8's System screen, you can view or change the computer name and workgroup name.
Next, launch Hyper-V Manager and access your virtual machine. Choose your virtual machine and select Connect from the Action menu. When your Windows XP Virtual Machine Connection window appears, click the Green Start button. When you see the Windows XP Login screen, select your user name and enter your password, as shown in Figure C. Make a mental note of this user name and password, as you will need them later.

Figure C

Fig C 7-26.png
Launch Hyper-V Manager and access your Windows XP virtual machine.
When Windows XP starts up, press [Windows]+[Break] to bring up the System Properties dialog box and then select the Computer Name tab. Then click the Change button and make sure that your Windows XP virtual machine has a unique computer name and is using the same workgroup name as your Windows 8 host machine. As you can see in Figure D, on my example system the computer name is vm-one-xp and the workgroup is SOLAR SYSTEM. Keep in mind that you will be prompted to Restart the system if you change the computer name or the workgroup name.

Figure D

Fig D 7-26.png
Make sure that your Windows XP virtual machine has a unique computer name and is using the same workgroup name as your Windows 8 host machine.
Once you are done with your network configuration, make sure that from each machine's Network list you can see both the host machine and the host machine. As you can see in Figure E, both Jovian-8 and Vm-one-xp are visible from Windows XP's Network Neighborhood and both are visible from Windows 8's Network view in File Explorer.

Figure E

Fig E 7-26.png
Make sure that you can see both the host machine and the host machine from within each machine's Network list.

Enabling remote connection

One more thing that you have to do on your Windows XP virtual machine is enable the remote connection. To do so, press [Windows]+[Break] to bring up the System Properties dialog box and then select the Remote tab. Then, select the Allow users to connect remotely to this computer check box in the Remote Desktop panel, as shown in Figure F.

Figure F

Fig F 7-26.PNG
In Windows XP, make sure that the system is ready to accept requests from Remote Desktop Connection.
At this point, you can click OK and then restart the Windows XP virtual machine. When your Windows XP virtual machine restarts, it will be available on the network, but you won't need to log in again right now. In fact, you can minimize your Windows XP Virtual Machine Connection window and close the Hyper-V Manager window.

Configuring Remote Desktop Connection

Now that you Windows XP virtual machine's network and remote settings are correctly configured, you're ready to configure your Windows 8 Remote Desktop Connection. To do begin, use the [Windows] + Q keystroke to access the Search Apps page. Then, type Remote in the text box and click the Remote Desktop Connection icon when it appears in the Results.
When you see the Remote Desktop Connection window, click the Show Options button at the bottom of the screen to reveal the entire window with all the tabs. Then, type the name that you assigned to your Windows XP system and your Windows XP User name in the appropriate text boxes. Then, click the Save As button and assign your connection a name. This process is illustrated in Figure G.

Figure G

Fig G 7-26.PNG
You'll want to save you Remote Desktop Connection configuration.
Normally, I would select the Allow me to save my credentials check box, to automate the login procedure, but for some reason, I have not been able to get that feature to work when connecting to a Windows XP virtual machine via Remote Desktop Connection - it just locks up the connection procedure. So make sure that you leave the check box blank.
To continue, click the Local Resources tab. Here is where you can pick and choose what resources connected to the host machine, such as USB drives and USB printers, which you want to redirect to the virtual machine.
In the Local devices and resources section, both the Printers and Clipboard check boxes should already be selected. You can then click the More button. When you do, you'll see a window that shows a list of other types of local devices that can be redirected to the virtual machine. These steps are illustrated in Figure H.

Figure H

Fig H 7-26.png
Clicking the More button reveals a list of other types of local devices that can be redirected to the virtual machine.
Having the Printers check box selected means that the Canon iP3500 USB printer connected to my Windows 8 system will now be available to the Windows XP virtual machine. (It will need some further configuration as I'll show you in a minute.)
As you can see, I've selected just about every available check box in the second Local devices and resources window. The only thing I didn't select is the DVD drive because it's already connected to the virtual machine. However, I selected Local Disk (C:), which means that I will have access to the hard disk on the host machine from within the virtual machine. I also selected IOMAGIC (E:) which is a USB drive connected to the USB port on the host machine. I then selected the Drives that I plug in later check box, so that any time I connect a USB flash drive to the host machine, it will be accessible in the virtual machine.
To continue, click OK to close the second Local devices and resources window. Then, return to the General tab and click the Save button. You can leave all the other default settings in Remote Desktop Connection as they are.

Making the first connection

With all the necessary settings in place, you can launch Remote Desktop Connection by clicking the Connect button. When you do, you'll see the login screen, shown in Figure I, and will notice another advantage of using Remote Desktop Connection - you automatically get a full screen display of your virtual machine. After you enter your password and click OK, you'll be connected via Remote Desktop Connection to your Windows XP virtual machine in Hyper-V.

Figure I

Fig I 7-26.png
With Remote Desktop Connection - you automatically get a full screen display.
Once your Windows XP virtual machine is up and running, go ahead and open up My Computer. When you do, you'll find that there are connections in the Other section to the hard disk and any other USB disks have on you Windows 8 host machine, as shown in Figure J. Now, you can easily access files and folders on your host machine from within your virtual machine.

Figure J

Fig J 7-26.PNG
The host machine's hard disk and USB disks are now available in your Windows XP virtual machine. Configuring your printer
While the disk drives are automatically redirected from your host machine to your virtual machine, your USB printer will require some additional configuration before it is fully accessible in your virtual machine. The first thing that you must do is install the driver on your Windows XP virtual machine. You can do so, from the CD that came with your printer or you can download the driver from the Web. In the case of my Canon iP3500 USB printer, I downloaded the Windows XP driver installation package from the Canon web site, and then ran it, as shown in Figure K.

Figure K

Fig K 7-26.PNG
You can install your printer driver in Windows XP from a CD or a download.
With the driver installed, you can now add the printer. Go to the Control Panel and launch the Add Printer Wizard. On the second screen, select the Local printer attached to this computer option, but then clear the Automatically detect and install my Plug and Play printer check box, as shown in Figure L. To continue click Next.

Figure L

Fig L 7-26.png
Be sure to clear the Automatically detect and install my Plug and Play printer check box.
When you get to the Select a Printer Port screen, select the Use the following port option and then click the drop down arrow. When you do, you should find a group of Terminal Server ports identified with the codes TS00# {Host machine name} PRN#. These are the ports that are redirected from the host machine to the virtual machine via Remote Desktop Connection. You should select the TS001 port, as shown in Figure M. Then click Next.

Figure M

Fig M 7-26.png
The TS00# ports are those that are redirected from the host machine to the virtual machine.
You will now see the Install Printer Software screen, from the Manufacturer list select your printer brand name. Then in the Printers list, scroll all the way to the bottom and you should find the printer driver that you installed earlier. As you can see in Figure N, I selected Canon and then found the Canon iP3500 printer driver that I downloaded and installed.

Figure N

Fig N 7-26.png
The printer driver that you installed should now be in the list of Printers.
As you work your way through the rest of the Add Printer Wizard, as shown in Figure O, be sure that you select the Keep existing driver option and then print a test page to ensure that your printer is working correctly.

Figure O

Fig O 7-26.png
Work your way through the rest of the Add Printer Wizard.

Going forward

Now that you know how to make USB devices accessible to a Windows XP virtual machine via Remote Desktop Connection, there are a couple of things that you need to keep in mind. First, you will always have to launch your Windows XP virtual machine from the Hyper-V Manager and the Virtual Machine Connection. And you also need to let it run for a few minutes before you attempt to connect to it from Remote Desktop Connection. When you are finished using your Windows XP virtual machine for the time being, you will have to Log off from the virtual machine, which will close the Remote Desktop Connection. Then you will have to return to the Virtual Machine Connection window and then use the Turn off computer on the Windows XP screen
Second, I've found that Terminal Server ports can be a bit quirky at times. If you discover that the printer is no longer printing, access the Printer Properties page, select the Ports tab, and choose a different TS00# port.




0 comments:

Post a Comment