How to set up a Windows 7 virtual machine on Windows 10

Several months ago, I decided it was past time to set up a Windows 7 virtual machine on my home computer. It’s not something I need on a daily basis, but I want to have that environment available in case some future Windows 10 update changes something to the point where one of the programs I use no longer works.

I opted to go with the 32-bit version of Windows 7, and found a legitimate license key for sale on eBay. Once I had the installation media in my possession, I fired up VirtualBox. If you’re wanting to do what I did, here are the steps:

  1. In VirtualBox Manager, click New. Enter the name for your virtual machine and select the type and version; as mentioned previously, I’m using Windows 7 (32-bit). Click Next.
  2. Specify amount of memory—I chose 2048 MB—then click Next.
  3. Select Create a virtual hard disk now, then click Create.
  4. Choose your hard disk file type. The recommended and default setting is VDI (VirtualBox Disk Image), but you can choose something different if you have a particular need. Click Next.
  5. Select type of storage on physical hard disk. I selected Fixed size. Click Next.
  6. VirtualBox defaults to a virtual hard drive of 25 GB. Adjust this if necessary—I bumped it up to 40 GB since I have plenty of space on the drive where I’m storing VMs—then click Create. The virtual hard drive creation process takes several minutes.
  7. Start your virtual machine. Select your startup disk (or .ISO file) and click Start.
  8. Proceed through the Windows installation process:
    1. Choose language to install, time and currency format, and keyboard or input method, then click Next.
    2. Click Install now.
    3. Check the “I accept the license terms” checkbox, then click Next.
    4. Choose the custom (advanced) installation type.
    5. With Disk 0 Unallocated Space selected, click drive options (advanced), then click New, then click Apply and click OK.
    6. After setup finishes create disk partitions, click Next. Setup will take several minutes to install files.
    7. After the virtual machine restarts, enter the user name and computer name. Click Next.
    8. Enter a password and click Next.
    9. On the Windows product key screen, click Skip.
    10. Choose Windows Update settings.
    11. Select time zone, then click Next.
    12. Select your computer’s current location, either home or work.
    13. After Windows starts, change the screen resolution; default is 800×600 pixels.
    14. While holding the Windows key on your keyboard, press the Pause/Break button to launch the system information window.
    15. Click the “3 days until automatic activation. Activate Windows now” link.
    16. Click Activate Windows online now.
    17. Enter your Windows product key, then click Next. After activation completes, click Close.
    18. Install Windows updates, restarting the virtual machine as necessary.
  9. After you finish installing and updating Windows, go to VirtualBox’s Devices menu and choose Insert Guest Additions CD image. When the AutoPlay window appears, click Run VBoxWindowsAdditions.exe, then tell the UAC prompt Yes.
  10. Click Next.
  11. Click Next again.
  12. Click Install.
  13. When the Windows Security window appears, click Install.
  14. When the Windows Security window appears again, click Install.
  15. Click Finish to reboot.

After the virtual machine restarts, you might need to adjust the screen resolution again. After that, you’re done!

How to delete .cab files from Windows Temp folder and prevent them from regenerating

I recently noticed at work that my Windows 7 virtual machine’s C: drive was down to its last couple of gigabytes of free space. What’s up with that? I wondered. After doing a bit of poking around, I discovered that the Windows Temp folder was clogged with multiple .cab files, nearly 32 GB of them in this case. Not cool!

It seems that all of these files are related to Windows updates not installing correctly, or something along those lines. The solution given by Microsoft forum user 5kyFx is this:

  1. Delete the .log files from %systemroot%\Logs\CBS (which prevents the .cab files from being regenerated)
  2. Delete the .cab files from %temp% (which clears space on the drive)

In my case, this appears to have solved the problem.

How to adjust the size of your Hyper-V virtual machine’s window

I recently started a new job, and due to the need to make VPN connections, I’ve been getting familiar with Hyper-V Manager. I’m using a laptop, so one of the first things I wondered was how I could fix the size of my virtual machine’s window so that I don’t have to do a lot of scrolling. Unlike with Remote Desktop Connection, where you can specify the size of the window before connecting, Hyper-V Manager did not appear to have such a configuration option.

It turns out the answer to my question is very simple: for a Windows 7 virtual machine, at least, all you have to do is change the screen resolution on the VM itself. To do that, right-click on the VM’s desktop and choose Screen Resolution (for Windows 7) or Display settings > Advanced display settings (for Windows 10) and choose a resolution small enough to fit on your physical computer’s display.

After you adjust your VM’s resolution, the window in which the VM is running resizes itself automatically, and you’re good to go.