Monday, December 10, 2012

Run Android on your computer - A review of Android emulators


Running Android on your PC
There are now several options for running Android on your PC. While developers will be using the Android Virtual Device emulator (part of the Android SDK) to test their apps, this post is aimed more for users who just want to use their favorite apps and games on their computer. Most of these emulators require virtualization software like VirtualBox (free) or VMware Workstation, which essentially allow you to run a computer inside of your computer. If you're unfamiliar with this type of software, check out this Beginner's Guide to Using VirtualBox.

The good news is that the emulators in this list all appear to be in active development, meaning they will continue to improve. The bad news is that as of right now, many of your favorite apps may not work correctly or work at all inside these emulators. Apps that you control by tilting your device, for example, will not work correctly because you cannot tilt the emulator. I've compiled the list below based on emulators I have tried. If there are any I've missed, please post them in the comments. The apps are not listed in a particular order, but if you're looking for my recommendations, head down towards the bottom of the list. As AndroVM is my recommendation for most complete Android experience, I've included step-by-step instructions for installing it on your computer. This guide is written for Windows users, but many of these emulators can also be run inside VirtualBox on Mac and Linux.

I should clarify that these are Android emulators. They create a virtual Android device on your computer. Manufacturer-specific "On-Screen Phone" software is not included here.

As with all posts, if you find anything in this post to be incorrect, please leave a comment. I will update with corrections as I become aware of them.




Available for: All (web-based)
Price: Free
Requirements: Any modern web browser

Manymo.com is a web-based Android emulator used to help developers test apps on a variety of device sizes and Android versions. Creating a free account allows you to use Eclipse, IntelliJ/IDEA, and Android SDK tools; as well as upload and run apps. This is not the emulator you're looking for if you just want to play around with Android,  but it is an emulator nonetheless so was worth a mention here. The ability to select between screen sizes and Android versions makes it a great tool for developers, as it was designed for. But if you're looking for something to play apps or games on, this is not it.





Youwave for Android
Available for: Windows
Price: $14.99 - $19.99 (free fully-functional 10-day trial)
Requirements: That you do not have VirtualBox installed. If you do, install it inside a virtual machine.

Being the only non-free option on this list, I had high expectations for Youwave for Android. Youwave is available in two editions:
  • Basic (2.3 Gingerbread) for $14.99
  • Home (4.0.4 Ice Cream Sandwich) for $19.99
The Home edition also allows you to share data between your PC and virtual device, treating a user folder on your PC as the device's SD card. You'll also want Home edition if you plan on using the device across multiple users accounts on your PC. You can try either edition by downloading and using the fully-functional 10-day free trial.

As you'll see on the download page in bright red text, you should NOT install Youwave if you have VirtualBox installed on your PC. Instead, you'll need to run it inside a virtual machine. This is because Youwave is a VirtualBox VM (virtual machine) with a not-so-elegant wrapper.

I installed it to a Windows 7 Ultimate x64 VM running inside VirtualBox 4.2.4. I expect this may have a slight affect on performance, although many people interested in running an Android emulator will have VirtualBox installed... so I think this is a fair test setup. For those interested, I tried it on an Intel i7 940 @3.47GHz (VT-x on), 12GB DDR3 @1600MHz, BFG GTX 285, and separate hard drives for the OS and VM. The VM is setup to use 4 cores, 4GB memory, 256MB video memory. With that said, it is running a VM inside of a VM and performance is bad. Clicking the Home or Menu (or any) buttons often meant waiting for several seconds, wondering if it registered the click.

Admittedly, I didn't spend a whole lot of time with Youwave because there are other Android VMs that you can run inside VirtualBox that are just as good or better... and are free! I'd rather devote time to writing more about those. What Youwave has going for it is an easy installation, seamless mouse support, and out-of-the-box working Internet access. What hurts it is a quirky interface - sliding from one panel to another usually gets stuck halfway through, the issue with existing VirtualBox installations, and the price.

Youwave for Android didn't come with the Google Play Store app pre-installed, but there is an option to install it (Android Market app). However, while it appeared to download and load correctly, an icon for the Market app never appeared (even after following the instructions and selecting Reload icons from the menu.

While I don't recommend Youwave because there are currently better alternatives, I invite anyone who installs it outside of a VM to comment on its performance.






Available for: Windows, Mac, Linux
Price: Free
Requirements: None
Website: http://forum.xda-developers.com/showthread.php?t=1975675

Jar of Beans is a portable Android emulator, also still in beta, that supports Intel Hardware Accelerated Execution Manager (HAXM). It is currently based on rooted Jelly Bean 4.1.1 with Busybox. I've read positive reviews for it, but I experienced pretty bad performance using it even with GPU accelaration enabled. You can select from a number of display resolutions, and anything over 1280x768 will be displayed in tablet-mode. After attempting to increase the RAM from 512MB to 1GB in the program's settings, the emulator crashed every time I attempted to run it (even after lowering it back down to 512.) I did eventually get it working again by switching users in the Jar of Beans launcher. The emulator looks promising, and has one thing going for it that the others don't - portability. It also has seamless mouse integration similar to VMLite. That and the hardware acceleration improving make it one to keep an eye on.














Available for: Windows, Mac, Linux
Price: Free
Requirements: VirtualBox or VMware
Website: http://www.android-x86.org/

The most well-known is Android emulator is probably the open-source Android x86 project. I recently installed RC2 of Android x86, and while it works well, I ran into network problems that prevented apps (including the Google Play Store) from accessing the Internet. For those who have the Android x86 VM already installed in VirtualBox and are not able to connect to the Internet (even with the browser), you can try the following:
  • Use a bridged network connection between the virtual machine's virtual network adapter and the adapter that your computer uses to connect to the Internet (Settings -> Network -> Adapter 1). Then start the emulator and open the included Terminal Emulator app, and enter the following lines  (pressing Enter after each line):

     suifconfig eth0 up 192.168.2.250
    route add default gw 192.168.2.1 dev eth0
    setprop net.dns1 192.168.2.1
    Note that I'm using a Belkin router (192.168.2.1) so your router's IP (used in the third and fourth lines) may differ. You can find the IP of your VirtualBox adapter (used in the second line) by going to the command prompt in Windows and typing ipconfig /all, then press Enter. You'll also have to do this each time you run the VM. There may be better ways to do this, and do it permanently, but I have limited Linux experience so maybe someone can post a better solution in the comments.

    This should enable Internet access through the browser, however it still will not work for apps like the Play Store.
     
While I was able to access the Play Store web site through the browser, I was not able to install apps from it because I had not accessed the Play Store through its app from the Android device I was using (the virtual one.) This is a requirement Google has put in place before installing apps from the Play Store website. I could, however, mount a USB drive to the virtual device and browse to it using a file explorer app and sideload apps that way.

If you're interested in trying out the Android x86 project, I recommend to keep reading and check out the AndroVM emulator further down the list. As it is a better working and easier-to-get-started VM based on the Android x86 project, you'll probably have a better experience using it at this point.





Available for: Windows, Mac, Linux
Price: Free
Requirements: VirtualBox

VMLite is a virtual machine for VirtualBox based on Android 4.0.4 ICS. One thing VMLite has over the similar emulators like Android-x86 and AndroVM is seamless mouse support, meaning the mouse seamlessly transitions from your desktop to the virtual machine without getting trapped inside (you have to press a specific key to un-trap it.) While VMLite is easy to install (simply unzip the archive and open the VMLite-Android-v4.0.4.vbox file (in VirtualBox) and has a working Internet connection, I was disappointed that it did not come with the Google Play Store app, nor a file explorer app to browse a mounted USB drive. This means that you won't be installing apps right off the bat. Here is how I was able to install apps to it:
  1. Go to Settings -> Security and allow apps to be installed from Unknown Sources.
  2. Setup a web server on your computer, hosting your .apk files.
  3. Use the browser in VMLite to access your web server. Navigate to the folders that contain your .apk files.
  4. Click on an .apk file to download it to the virtual device. When the download completes, click on the .apk and select Install. When installation is complete, select Open.

As with Android-x86, keep reading down and you'll see that AndroVM provides a better experience (minus seamless mouse support.)





Available for: Windows (beta), Mac (Alpha)
Price: Free
Requirements: None

Another option is BlueStacks, a Windows-based app player. The software comes with several apps pre-installed, a large and growing app store, and using the BlueStacks CloudConnect app on your Android device allows you to send apps from your real Android device to the app player on your PC. I had trouble getting the CloudConnect to actually work... it immediately said "Please check network connection and try again" when trying to register and sync my phone. I created firewall rules for every BlueStacks executable I found and checked that nothing else was preventing it from working, but it still may just be a problem on my end. As of writing this, BlueStacks is still in Beta and can be downloaded for free from their website.

The benefit of using BlueStacks is that all of the apps in the BlueStacks app store should be working correctly. Although still in beta, it is a somewhat controlled environment... so if you're not one to tinker with and tear apart your Android and just want to play your favorite Android apps on your computer, it may provide the best experience for you.













Available for: Windows, Mac, Linux
Price: Free
Requirements: VirtualBox or VMware

While these options are all still in active development and will continue to improve, if you're looking for something that works right now and provides the full feel of an Android device, you'll want to check out AndroVM. Formerly called Buildroid, AndroVM is also now open-source and based on the Android x86 project. Currently it uses Android Jelly Bean 4.1.1. It comes in three different flavors: Phone, Tablet, and Tablet with phone capabilities. For each flavor, you can download the standard version, or download the standard + Google apps + Houdini (ARM compatibility app.) If that's confusing, the download options break down like this:

Files
  • Android Phone (vbox86p)
  • Android Phone + Google Apps + Houdini (vbox86p with gapps + houdini)
  • Android Tablet (vbox86t)
  • Android Tablet + Google Apps + Houdini (vbox86t with gapps + houdini)
  • Android Tablet with phone capabilities (vbox86tp)
  • Android Tablet with phone capabilities + Google Apps + Houdini (vbox86tp with gapps + houdini)
Note that you cannot actually make phone calls with any of these. Phone capabilities were added to the Tablet version because some apps refused to install on a non-phone device.

These downloads come as .ova files (Open Virtualization Format Archive) so you can use them in VirtualBox or VMware. I tested AndroVM in VirtualBox 4.2.4 and in VMware Workstation 9. I did get an error importing the .ova file in VMware, but clicking the Retry button on the error message led to it trying again and loading successfully. For the purposes of this review, I'll be using it in VirtualBox.

While you're on the AndroVM download page, you'll also see downloads for AndroVMplayer, a separate program that you can run with your virtual machine to enable hardware OpenGL. There are 32-bit and 64-bit versions of AndroVMplayer for Windows and Linux, and a version for 64-bit Mac OSX. If you don't plan on using any OpenGL apps, you won't need this... but keep in mind that many games require OpenGL (although not all of them will necessarily work in AndroVM at the moment.) Installation instructions are below the screenshot.


   

Installation

Download the AndroVM version of your choice and if you want hardware OpenGL, also download the version of AndroVMplayer that matches your computer's operating system. If you're just wanting to play around with Android, I would recommend the Tablet with phone capabilities version to get the best of both worlds. Next, you'll need to open your virtualization software. If you don't have one installed, you can download and install VirtualBox for free.

Inside VirtualBox, click File -> Import Appliance... and in the Import Virtual Appliance window, click Open appliance... Navigate to where you saved your downloaded .ova file and select it to open. Click Next.

On the Appliance Settings screen, you can change the name of the virtual machine to something a little simpler, like AndroVM, by double-clicking on the name field. This isn't necessary, but the default name (the .ova filename) is pretty long. Next click the Import button. It may take a minute or two to import.

When it's done importing, select the newly-created virtual machine from the list on the left. Right-click on it, then select Settings... in the popup menu. In the Settings window (it may take several seconds to load), click on Display in the list on the left. Move the Video Memory slider all the way to the right. It will probably max out at 128 MB.

Next click on System in the list on the left. On the right, you'll then see a setting for Base Memory. The default is 1GB (1024MB), but if your computer has 4GB of RAM or more, you may want to increase this to something like 2GB (2048MB.) This may be more than necessary, but if you got it you may as well use it. Keep in mind that you can go back and change these at any time in the future as long as your virtual machine is powered off.

Next, click on Network in the list on the left. Click on the Adapter 1 tab, and change the Attached to: setting to Host-only Adapter. Click on the Adapter 2 tab, and change the Attached to: setting from NAT to Bridged Adapter. (You can use NAT, but I prefer to bridge adapters.) Next, change the Name: setting to the adapter your computer uses to connect to the Internet. For example, if your computer connects to your router wirelessly, you'll find your wireless adapter in the list. If your computer plugs into your router via a network cable, you'll see your ethernet adapter listed. The names of these vary, so I can't tell you exactly what your adapter will be called.

Bridging your adapter will do exactly what it sounds like - create a bridge between your real network adapter (the one you use to connect to the Internet) and the virtual network adapter your Android virtual machine will be using. The reason we are doing this with Adapter 2 and not Adapter 1 is that AndroVM uses Adapter 1 to communicate with the AndroVMplayer program when you enable hardware OpenGL.

Click OK at the bottom of the Settings window to apply the changes. We're now ready to start our virtual machine. Make sure the AndroVM virtual machine is selected, and click the Start button in the toolbar.

If you've never used VirtualBox before, you'll notice that if you click inside the virtual machine screen, the mouse becomes trapped inside it. If you want to get the mouse back outside of it, the default key to press is the right Ctrl key.

The Android virtual machine will startup, and just like a new Android device, take you through the setup process where you select your language and link it to a Gmail account. You may want to create a new Gmaill account to use with your virtual device, rather than using an account tied to a real Android phone or tablet. After you select your language, you should see a Got Google? screen where it asks you if you have a Google account. It may take a few seconds to appear on your first startup. If you don't see this screen, you might have bridged to the wrong network adapter. Power-off the machine, go back to Settings -> Network -> Adapter 2, and select the correct adapter in the Name: list.

Once you complete the setup process and log into a new or existing Gmail account, you're finished. You can access the Google Play Store to download apps. Similarly to Android x86, you can mount a USB drive to the virtual Android device by clicking Devices in the virtual machine's menu. Then select USB Devices in the drop-down menu, and select the USB drive you want to mount in the sub-menu. You can then access the drive using a file explorer app (there are free ones that will do this available from the Play Store.) You can also use an app like Airdroid to access the virtual Android app from your computer's web browser, and install apps using its interface.

To enable Hardware OpenGL:

As I mentioned, you can download AndroVMplayer to enable hardware OpenGL on your virtual Android device. To enable it:

  • Inside your Android virtual machine, click the apps icon (6 small squares in the top-right corner of the home screen) and start the androVM Configuration app. Check the Hardware OpenGL checkbox. You'll need to reboot the device for the change to take effect.

    When you do reboot your Android virtual machine, it will now get stuck. It will display something along the lines of "IP Management: 192.168.56.101" and other text on the screen. This is because the AndroVMplayer is not running. To resolve this, open the command prompt (Start -> cmd) and navigate to the folder where you unzipped the downloaded AndroVMplayer to. As an example, we'll say that I unzipped the program to C:\AndroVM. So with my command prompt pointed at C:\AndroVM, I type AndroVMplayer 1280 800 160 and press Enter. (1280 is width, 800 is height, and 160 is ppi. You can set these to the resolution of your choice.) After pressing Enter, you may get a message from your firewall software asking if you want to create an exception - if you do, click Allow. You should then see the Android virtual machine displayed inside the AndroVMplayer window instead of inside the VirtualBox window. Now OpenGL is enabled.

    While OpenGL is required to run some apps (mostly games), the AndroVMplayer window does not accept scroll wheel input, which can be a little annoying at times. I suggest enabling it when you want to run apps that require it, but to disable it if you're not going to be using it.
To disable Hardware OpenGL:
  • If you're running your Android virtual machine inside the AndroVMplayer window, then you can navigate back to the androVM Configration app and disable it.

    However, there is an easier way to disable it that will work even if you can't get into the Android virtual machine. This way is great to have in case you have problems getting the hardware OpenGL to work, you can always revert back to having it disabled. To do this:

    Create a batch file and paste the following text into it:

            "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" guestproperty set "AndroidVM" hardware_opengl
      

    Running the batch file (while the Android virtual machine is powered off) will then disable OpenGL. Next time you open it, it will open normally and will not require the AndroVMplayer program to be running.

    The line used above is written assuming that you named your virtual machine AndroidVM so you may need to change that to match the name you set after importing the .ova file into VirtualBox. It also assumes that you installed VirtualBox into the default installation directory. If you installed it elsewhere, you'll need to change the VBoxManager.exe file location.

    You can also navigate to the VirtualBox installation folder in a command window and type

            vboxmanage.exe guestproperty set "AndroidVM" hardware_opengl

    Don't forget to change "AndroidVM" to the name of your virtual machine.





Those looking for a Windows Phone emulator should check out Windows 8's Modern UI and Windows Store. If you don't want to upgrade, you can run a Windows 8 virtual machine using VirtualBox or VMware. There is also a Windows Phone emulator, part of the Windows Phone SDK.

If you're looking for a similar experience with iOS devices like iPhones and iPads, there are some projects you may want to check out:
  • iPadian - A free portable application that reproduces the iPad experience on a Windows desktop.
     
  • iEmu - An ambitious project by one of iOS's earliest jailbreakers, Chris Wade, to get iOS up and running in an emulated state on Linux, Windows, Mac, and Android. No public release yet, but you can download and compile the source from here: https://github.com/cmwdotme/QEMU-s5l89xx-port
     
  • And of course there is the iOS simulator, part of the iOS SDK. (Available on Mac OSX only.)








UPDATE: (Feb 2013)


Available for: Windows
Price: Free (as of early release)
Requirements: None


WindowsAndroid, claims to run Android natively inside Windows. This means no virtualization software like VirtualBox or VMware is needed. This could allow apps to run better and faster than the other emulators, assuming they can work the bugs out. The software is still in development, so expect crashes. I tried it on both Windows 7 x64 and Windows 8 x64, and was unable to get past the Android loading screen, so I am unable to review it. However, some seem to have had more success.

WindowsAndroid does not come with Google Apps (including the Google Play Store) built-in. To get those, you can download them manually and follow this guide. This might not get you access to the Play Store though, as many have reported that accessing it results in an "Incompatible device" message.

Although I was unable to review WindowsAndroid, I feel it is something to keep an eye on and felt it should be added to the list.









Friday, December 7, 2012

Installing Windows 7 onto a USB flash or external drive


*See the update at the end of this post for information regarding Windows activation using this method. Also, if anything in this post is incorrect, please comment. I will update with corrections any time I become aware of them. 

I recently inherited an old Dell Inspiron 1300 laptop. It's in bad shape. Along with a damaged screen, it was missing the hard drive, RAM, A/C adapter, and wireless adapter. My plan was to try to get it working only using things I already have. For this project, what I have includes:

So I have all of the pieces to the puzzle, it's just a matter of putting it together.

The RAM and A/C adapter are obvious.

The external monitor was easy enough - the Inspiron has a function key for switching to the external display. The key works during POST, meaning I can see BIOS on the external monitor if I press DEL fast enough.

The hard drive... well that's where the story begins. Trying to install Windows 7 on a USB drive doesn't work. Although Windows setup lists the drive during setup, it will not let you install it there. So we have to look elsewhere to get Windows 7 installed on our drive. We also have to ensure that it will actually boot, and not crash at the "Starting Windows" screen, which is the case if you try to hook up a drive with Windows 7 installed from another computer (after sticking it in a Sata-to-USB adapter.)

Enter VMware Workstation.

VMware Workstation is virtualization software for creating and running virtual machines. One important feature VMware has, as opposed to VirtualBox (I've been told you can do this in VirtualBox as well), is using a real disk drive for your virtual machine. This is how we will get Windows 7 installed on our hard drive, and be able to make the necessary changes to ensure it boots successfully while being plugged in via USB. Note that you will not need VMware to run Windows on the target machine. We're simply using VMware to get Windows installed onto our hard drive. VMware tricks the Windows installation into thinking that our drive is a SCSI drive, rather than a USB drive.

First, you'll need VMware Workstation. I'm using version 9, which you can download a free trial of from here. You'll also need a Windows 7 setup DVD or ISO. If you don't have one, the ISOs should still be available to download free from Microsoft via DigitalRiver.

Before beginning, you should backup any data that may be on the USB drive you plan on installing Windows 7 onto. Then format the drive (right-click and select Format... in the popup menu.) using NTFS file system. This will ensure our disk is clear and ready for Windows 7 to be installed onto.

I'll apologize in advance for the length of this guide... but I'll try to be as detailed as possible. I hate following broad tutorials that leave things out and have you guessing and questioning every step. Instructions start after the jump.




  1. Once VMware is installed, open it and select File -> New Virtual Machine... to create our new virtual machine.
     
  2. On the first step of the New Virtual Machine Wizard, select Custom (advanced), and click Next.
     
  3. Next ensure Workstation 9.0 is selected for Hardware compatibility, and click Next.
     
  4. Now we'll specify where our Windows 7 installation disc is located. If you have the DVD inserted into your DVD drive, or the ISO mounted, use the first option (Installed disk:) and specify which drive it is inserted (or mounted to.) If you have the ISO but do not have it mounted, select the second option (Installer disk image file (iso):) and specify where the ISO file is located. When you're done, click Next.
     
  5. On the next screen, enter your Windows 7 product key. If you don't have one, you can leave it blank and start your 30-day trial of Windows 7. You can also leave it blank and enter your product key later, after the installation is complete. Select the edition of Windows 7 you're installing in the dropdown. Create a username and password (optional) for your new Windows 7 account. Click Next.

    (You may be prompted about not entering a product key... just click Yes)
     
  6. Enter a name for your Windows 7 VM. Also, select where you want to save the VM files. Note, these files are for VMware to use. This is not where Windows 7 will actually be installed to. We'll be selecting our USB drive later. Click Next.
     
  7. Select the number of processors and cores the computer you plan on using your USB drive with has. In my case, the Inspiron has a single core processor, so I select 1 for processors and 1 for cores. Click Next.
     
  8. Select the amount of RAM your target computer has. In my case, I select 2GB (2048MB) as that is the amount I have installed in the Inspiron. Click Next.
     
  9. Next you'll select your network connection type. You can change this later, but I select Bridged Networking. While running the VM inside VMware, this will bridge my VM's network adapter with my host computer's network adapter, allowing them to exist on the same network. NAT may also work for you here. Click Next.
     
  10. Now we're getting to where we set our install location. When selecting the I/O Controller Types on the next screen, select LSI Logic. (NOT LSI Logic SAS.) Click Next.
     


  11. On the next screen, select the third option - Use a physical disk (for advanced users). Click Next.
     
  12. Now you have to choose the USB drive you want to install Windows 7 to. If you're not sure, you can click Start, type disk management, and select Create and format hard disk partitions. Use the list at the bottom to find the number of your USB drive (example: Disk 3, Removable.) Make sure Use entire disk is checked. Click Next.
    Keep the Disk Management window open, we'll be using it again shortly. If the disk number is not showing up in VMware Workstation (which happens if you plug in the drive after opening Workstation), you'll need to close Workstation and re-open it, then repeat steps 1-11.
     
  13. Next you'll enter a name to use for saving your disk file. This is for VMware to keep track of your VM. It will not be needed once we're done installing, so you can save it anywhere to your computer (do not save it to the USB drive you're installing Windows 7 onto.) Click Next.
     
  14. Finally, make sure Power on this virtual machine after creation is UNchecked. We're not quite ready to start it. Ensure that everything is set how you want it, and click Finish.
     
  15. Now we need to right-click on our newly created virtual machine in VMware, and click Settings... in the popup menu.
     
  16. In the Settings window, click on Hard Disk (SCSI) in the list on the left. Then on the right you'll see a button that says Advanced... click this button.
     
  17. Inside the Advanced Hard Disk Settings window, check the box that says Independent. Make sure the Persistent option is selected, and click OK.
     
  18. Now go back to the Disk Management window that we previously left open. (If you closed it, follow step 11 to re-open it.) Find the USB drive you want to install Windows 7 onto, and right-click on it. In the popup menu, select Change Drive Letters and Paths... Windows has assigned this drive a letter, but we need to remove it to make sure Windows doesn't interfere with the installation. To do this, inside the Change Drive Letters and Paths... window, click the Remove button. Then click OK.
     
  19. Now we're ready to start the VM and install Windows 7. Select your VM, and click the Play/Power on button.

    If you get an error saying "Bootmgr is missing. Press Ctrl-Alt-Del to restart." don't panic. This means that your VM is not set to boot from the DVD/ISO first. Follow the instructions in the first post here to be able to access your VM's BIOS boot options, and ensure that the CD/DVD drive is before Hard Disk Drive in the boot order.

    Your VM should start by booting to the Windows 7 setup DVD/ISO. You may get a message saying to press any key to boot from DVD. If you do, simply press any key. You may have to click inside the VM to activate the window so it will accept your keystrokes.
    (If the mouse gets stuck inside your VM, press Ctrl+Alt to release it.)
     
  20. Follow the steps to complete the Windows 7 installation. It should install with minimal input required.
     


  21. Once Windows 7 is installed and you see the desktop inside VMware, we'll need to make a few changes before we can be able to boot from it. Follow these steps to ensure that it works correctly. I'll list these steps separately because you will need to refer back to them later.
     
    1. Click the Start button, and type "regedit" and press Enter to open the registry editor.
       
    2. Navigate to the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services
       
    3. For each of the following services keys, we're going to change the Start value from 3 to 0, and the Group value from "Base" to "Boot Bus Extender" (no quotes.) If there is no Group value, create a new string value called Group and set it's value to "Boot Bus Extender"
              - usbccgp
              - usbehci
              - usbhub
              - USBSTOR
              - usbohci
              - usbuhci
      This will ensure that the USB drivers are loaded during boot... which is critical because we're booting to a USB drive. (UPDATE: Thanks to AlainCh, you can check the comments for info on creating a .reg file to do this all in one step.)
       
    4. Next we're going to enable the different disk modes to ensure that no matter which mode our target computer is using, Windows will load the services and be able to start. Inside the same key (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services) locate the following keys and change their Start value from 3 to 0.
              - iaStorV
              - msahci
              - pciide
       
    5. Now you can close Registry Editor. Open Windows Explorer (Computer) and navigate to the folder C:\Windows\System32\DriveStore\FileRepository\usbstor.inf_bb2778a0. Inside the folder, copy the file usbstor.sys. Now navigate to the folder C:\Windows\System32\drivers. We're going to paste the file here. If it already exists, you can cancel the paste. We just want to make sure it's here.
       
    6. Next, navigate to the folder C:\Windows and find the inf folder. We need to add some things to a few .inf files inside, but we won't be able to until we give ourselves the correct permissions to be able to modify the folder. To do this, right-click on the inf folder and select Properties in the popup menu. Click on the Security tab. Next click the Advanced button. Inside the Advanced Security Settings for inf window, click on the Owner tab. We need to make ourselves the owner of this folder. We do that by clicking the Edit... button. A new window will open, and list the Current owner of the folder (probably TrustedInstaller.) We need to change it to our user account.

      (If your user account name that you entered in step 5 is listed, select it in the list. If it is not listed, click the Other users or groups... button, then click Advanced... and then click Find Now. Find your user account in the list at the bottom and select it, then click OK. Back in the Select User of Group window, your user account will now be listed in the text box, click OK. Now you're back to the Advanced Security Settings for inf window, where your user account will be listed. Select it.)

      Making sure that your user account is selected in the list, check the box that says Replace owner on subcontainers and objects. Then click OK. You'll get a message saying that if you have taken ownership of this object, you'll need to close and re-open its properties... Click OK.

      Back at the Advanced Security Settings for inf window, click OK to close the window. Then back at the inf Properties window, click OK to close that window. Now we need to re-open it, so right-click on the inf folder and select Properties from the popup menu again, then select the Security tab. We're back to where we were, but we had to close it and re-open it to reflect the changes we made.

      In the inf Properties window (under the Security tab), seelect your user account from the top list. This is the account that we just made the owner. Next, check the Allow checkbox next to Full control giving our user account full control of this folder. Then click OK. We now have the permissions we need to edit files inside the inf folder.
      Now we're going to find three files inside the inf folder, and add text to them. The three files are:

              - usbstor.inf
              - usbport.inf
              - usb.inf

      The text we're going to add to them is:

              [*.AddService]
              StartType = 0
              LoadOrderGroup = Boot Bus Extender


      You can add the text anywhere in the file, just make sure to add a few new lines so it doesn't mess up any of the lines already in the files. I added them to the top of each file. When you're done with each file, make sure to save it. If it doesn't let you save it (you'll get a Save As dialog box when you try to save), then you missed something in this step and don't have correct permissions to modify this folder and its contents. Repeat this entire step, following it exactly.
       
    7. If you have saved the inf files, congratulations! Your hard drive is now ready to be used. You can make any other changes to your new Windows 7 install now, but I would hold off on installing updates.
       
    8. Shut down the VM. Next, use the "Safely Remove Hardware and Eject Media" icon in the system tray to eject your USB drive.
       


  22. Now you can plug your new drive into your target computer and boot to Windows from it. Make sure that the target computer is capable of booting to a USB drive, and that booting to a USB drive is set in the boot order options in BIOS.
     
  23. Windows should startup, and install drivers automatically for the new hardware it finds in your target computer. When it finishes, it will prompt you to restart... but DO NOT LET IT RESTART yet. For some reason, it is likely that Windows has reset the changes you made in the registry. You'll have to check the changes you made in step 21, and probably repeat them. If you don't, Windows will not startup after the restart! I learned this the hard way. In the beginning, you'll want to ensure that these registry changes have not been reset every time you go to restart the computer... because if you don't, you may end up having to start this whole guide over again. It also won't hurt to check and make sure the changes you made to those .inf files haven't been removed... but in my case they were still there. Only the registry changes had been reset. However, any time you install a new USB device and/or drivers for it, these .inf files and registry keys may be reset... so you'll want to always check them before restarting or shutting down the computer.
    If these do get reset and you find that Windows won't startup, you can always plug the USB drive back into your computer and open it in VMware Workstation, and make the changes again. However, if you change the computer name outside of VMware, you may have a problem opening it inside VMware... so you may want to change the computer name inside VMware right after installation.
     
  24. You will probably get the Performance Options window popping up each time you restart allowing you to set your page file options. However, it will not save any changes you make. This seems to happen because Windows 7 does not like the idea of running your page file off of a USB drive. While my Inspiron seemed to run alright without a page file, it is a good idea to enable it. To do this, we'll need to trick Windows into thinking it is not a USB drive. Here is how:

    1. Download Diskmod-0.0.2.2.zip (or if that doesn't work, you can try Diskmod-0.0.1.0.zip). I'm not sure if this will run on 64-bit versions of Windows, but it does work on 32-bit versions of Windows 7.

    2. Unzip it to anywhere on your USB drive from within your Windows 7 installation. Next, copy the disk.inf file from C:\Windows\inf to the folder where you unzipped Diskmod to.

    3. Click Start, type device manager, and press Enter. Double-click Disk drives, and right-click on your USB drive. Select Properties from the popup menu. In the Disk drive Properties window, click the Driver tab. Click the Update Driver... button. Next, click Browse my computer for driver software. Next, click Let me pick from a list of device drivers on my computer. On the next screen, click the Have Disk... button and navigate to the folder you unzipped Diskmod into. Select the diskmod.inf file and click OK. Click OK in the Install From Disk window. You'll now be back at the Update Driver Software - Disk drive window. In the list, you should have two options:

            - Disk drive
            - Disk with pagefile

    Select Disk with pagefile and click Next. You may get prompted about installing an unknown/unapproved driver, just click OK. Windows will install the new driver for your USB drive. When it is done, it will prompt you to restart to complete the changes. Before you do, set your page file using the steps below. (If this window isn't open, you can get to it by right-clicking Computer, then select Properties from the popup. This opens the Control Panel -> System window. Click Advanced system settings on the left, then the Advanced tab. Click the Settings... button in the Performance box. In the Performance Options window, click the Advanced tab. In the Virtual Memory box, click the Change... button.)

    Setting your page file: In the Virtual Memory window, click the System managed size option, then click the Set button. Next click the checkbox at the top that says Automatically manage paging file size for all drives. Then click OK. You'll get a warning that you'll need to restart before the changes can take affect.

    Now, restart the computer and you will see that your page file is now enabled.
     
  25. Once you're confident that everything is working correctly, you can disable some VMware-related services from running since you no longer need them. Click Start, then type msconfig and press Enter. In the System Configuration window, click the Services tab, then un-check the following services:
            - TP AutoConnect Service
            - TP VC Gateway Service
            - VMware Tools service
            - VMware Snapshot Provider
    (If you've installed Windows 7 to a USB flash drive, you'll want to disable the Disk Defragmenter service, as it will cause the drive to wear more quickly.)

    Then click the Startup tab. Uncheck the following startup programs:
            - VMware Tools

    You'll need to restart before these changes take effect.

    You'll also want to click Start, type device manager and press Enter. In the Device Manager window, double-click on System devices. Under System devices, you'll see VMware VMCI Host Device. Right-click on it, and select Uninstall in the popup menu. When asked if you want to remove the files, select No just in case you should ever need them again.


That's it! You can now perform Windows Updates and install any addition hardware you have. I had to download the drivers for my Netgear wireless adapter from Netgear's website, as Windows didn't find them automatically. For the first few times I needed to restart the computer, I always checked the registry changes I made to make sure they weren't reset. If you want, you can export those keys to .reg files, allowing you to restore them by merging the .reg files. I ended up with 7 .reg files that I combined all into one, so merging the one file put back all of the changes I made to the registry should they ever get reset. (UPDATE: See comments for creating this .reg file.) I installed Windows 7 Ultimate, so I may end up trying to use Group Policy to run this file before every shutdown... although I haven't tried to do this yet and am not sure it's possible (I can't imagine why it wouldn't be.) I also made several System Restore points in the beginning, to hopefully be able to revert back to one should there be any problems with startup. So far I haven't had to resort to this so I can't ensure that it will work.


In theory, you should be able to take your USB drive anywhere and boot to it on any computer (that supports booting to USB devices.) Because we changed the Start value of iaStorV, msahci, and pciide, Windows should startup no matter which mode the target computer's BIOS is set to.

Some things to mention:

  • My Dell Inspiron has USB 2.0 ports, yet using my 500GB GDrive I don't notice any slowness in normal desktop use. This may cause issues in more disk I/O-intensive software, but for normal everyday use (surfing the web, etc), don't let the fact that you don't have USB 3.0 ports discourage you. Running Windows 7 on a Pentium M with 2GB RAM from a USB GDrive is surprisingly quick and snappy, at least so far. Results will vary depending on the type of drive used (mechanical vs. flash.) I recommend using a mechanical drive for this type of installation.
     
  • I did not have an internal hard drive installed in the Dell Inspiron whatsoever. I've read that if you try to do this using Vista instead of Windows 7, the computer will not boot because Vista has some sort of disk verification that requires an internal IDE or SATA drive.
     
  • I installed using a Windows 7 SP1 ISO from Microsoft/DigitalRiver, and then successfully installed all Windows Updates without any problems. However, I can't say for sure that future updates or machine-specific updates won't break this. You should not use this method for critical work. As a last resort, you can always plug the drive back into your computer and use VMware to access the installation.
     
  • Microsoft recommends at least 16GB for Windows 7, so you'll want to use a 16GB or larger USB drive.
     
  • VMware Workstation is also available for Linux, but I only tested it running inside Windows 7.
     
  • Don't forget to activate your Windows 7. If you don't, you'll have a 30-day trial with full functionality. You can rearm 4 times, extending that trial to 120 days, by following these instructions.
     
  • If you install Windows Updates while not at the computer, Windows may restart automatically once they're installed... meaning you may miss the opportunity to check your registry and .inf files. If you're running Windows 7 Professional or Ultimate, you can use Group Policy Editor to disable automatic restarts after updates are installed. Other Windows 7 editions (like Home Premium) do not have Group Policy Editor, but you can follow the instructions here (third post) to disable automatic restarts after updates are installed. You'll still get the yellow nag screen, but Windows won't restart automatically.
     
  • If you end up trying this, please post your questions, advice, and results (good and bad) in the comments to let others know what works and what doesn't work. So far I have been able to boot to the drive on all three computers I've tried (although each causes Windows to install drivers the first time, which means I have to check those pesky registry keys and .inf files before the first restart.)


UPDATE:

My goal here was to use the external hard drive on a specific laptop. The laptop requires an IDE drive, which is why I couldn't just stick the SATA drive inside of it. I was aiming to get it working using only the components that I already had.

In response to questions about how this will affect activation when used on multiple computers:
Yes, moving from one PC to another will probably break activation, especially retail activations. If you used OEM activation, it should continue to be activated when used on PCs that share the same software licensing table (slic) in BIOS. What this means is that if you performed OEM activation on a Dell XPS 8500, it should remain activated on any other Dell XPS 8500... as well as other Dells that use the same slic in BIOS. Some OEMs use multiple versions of slic across their products, so the range of products it would work on varies by manufacturer.

I wrote the guide as a method for installing Windows onto a USB drive - not on activating it. If you need to use Windows from an external drive frequently across multiple computers, I suggest you look at Windows-to-Go, a feature in Windows 8 Enterprise. The average home user doesn't have access to Enterprise editions, so this is an alternative. Moving from PC to PC may require re-activation each time, and I should have made that clearer in the original post. As is, I linked to the instructions for rearming, allowing up to 120 days in fully-functional trial mode. Alternatively, bootloaders that spoof the slic work for with this method on OEM activations, but I am not advocating their use. I have not tested this method with KMS activation, but that is another option if you plan on using the drive across multiple devices. At any rate, using one Windows 7 install across multiple computers probably violates Microsoft's licensing agreement, so you're on your own figuring out the activation method that fits your situation.


Credit to this and this and this for help creating this guide.