使自己免受病毒、恶意软件和间谍软件(malware and spyware)侵害的一个好方法是使用虚拟机而不是普通的Windows PC来浏览Internet 。那么什么是虚拟机呢?它基本上是一个完整的 Windows 副本,(Windows)在另一个称为主机的Windows副本中运行。(Windows)
Windows的虚拟版本只是一个大文件,在您的Windows 计算机(Windows computer)上运行的特殊软件(虚拟化软件(virtualization software))充当假计算机,以便Windows可以运行。您在虚拟机中所做的任何事情都不会影响您的主机操作系统(host operating system)。因此,您可以将 10 个病毒下载到虚拟机上,您的主操作系统(operating system)将是安全的。
虚拟机的好处在于您可以重置它们。因此,如果您在浏览虚拟机时感染了病毒,您只需将虚拟机重置为首次安装时的默认状态并重新开始即可。(default state)这也是增加隐私的好方法,因为您可以简单地擦除您在虚拟机中所做的任何事情。
在开始之前,让我们先谈谈要求。有许多软件虚拟化(software virtualization)工具,例如VMWare、Parallels、VirtualBox等,但我将只使用 Microsoft 软件。为了使它起作用,您需要两件事:
- Disk2VHD – Microsoft提供的免费工具,可用于将任何Windows 操作系统(Windows operating)从Windows XP开始转换为虚拟机文件(machine file)。
- Windows 8.1 Pro 或 Windows 10 Pro(Windows 8.1 Pro or Windows 10 Pro) – 您需要Windows 8.1或 Windows 10 的(Windows 8.1)Pro版本才能完成此过程。两种操作系统都有一个名为Hyper-V的工具,可用于访问由Disk2VHD创建的虚拟文件。
还值得注意的是,即使您可以使用Windows XP、Vista和 7 作为虚拟机,但如果您可以转换Windows 8.1或 Windows 10 机器,则最好,因为Hyper-V支持这些旧操作系统的最高分辨率是 1600 ×1200。这真的很烦人,我不知道为什么微软(Microsoft hasn)还没有费心解决这个问题。无论如何,这只是那些拥有高分辨率显示器的人的问题。
将 Windows 操作系统转换为 VHD
让我们从简单的部分开始:将当前版本的Windows转换为虚拟机(VHD 或 VHDX 文件(VHD or VHDX file))。为此,请下载上面提到的Disk2VHD 工具(Disk2VHD tool)并运行EXE 文件(EXE file)。
当你运行它时,你会看到一个像上面那样的屏幕。除了选择要保存VHDX 文件(VHDX file)的位置和要包含的卷之外,您实际上不需要做太多事情。
如果您有一个大硬盘驱动器,您可以让它将文件保存到与Windows相同的分区。如果没有,请选择其他位置,例如第二个硬盘驱动器或外部USB硬盘驱动器。默认情况下,它将选择它在您的计算机上找到的所有卷,这可能不是您真正想要的。
就我而言,我有几个硬盘驱动器连接到计算机,所以我只想选择卷 C:,它的大小为 37.26 GB。此外,您要确保选择安装Windows时创建的任何其他卷,最有可能的是引导( Boot )卷和系统保留( System Reserved)卷。这些通常非常小:在我的例子中,系统保留卷(System Reserved volume)只有 34 MB,而另一个没有标签的卷只有 322.08 MB。
除了主Windows 卷(Windows volume)之外,选择这些其他卷非常重要,因为如果不这样做,操作系统(operating system)将在您将其加载到Hyper-V时无法启动。相反,您会收到一条引导失败(Boot Failure)消息!这是因为这两个额外的卷告诉系统Windows所在的位置以及如何引导它。
创建VHDX 文件(VHDX file)可能需要一些时间,具体取决于 Windows 分区的大小。完成后,您将拥有一个非常大的文件和两个较小的文件。
在 Windows 8.1/10 中安装 Hyper-V
接下来,我们必须在Windows 8.1或 Windows 10 Pro中安装(Pro)Hyper-V工具。如果您有家庭(Home)版,则必须先升级到Pro,然后才能安装Hyper-V。(Hyper-V. Click)单击开始并输入(Start and type)windows features(windows features)。
在顶部,单击打开或关闭 Windows 功能( Turn Windows features on or off)。将出现一个窗口,您可以在其中检查要安装的额外项目。继续并选中Hyper-V复选框。它还应该自动选中Hyper-V 管理工具(Hyper-V Management Tools)和Hyper-V 平台(Hyper-V Platform)的复选框。
单击确定(Click OK)并让Windows安装这些功能。您还必须重新启动计算机。启动备份后,单击开始(Start),所有应用程序(All Apps),然后向下滚动到Windows 管理工具(Windows Administrative Tools)。您应该会在此处看到Hyper-V 管理器(Hyper-V Manager)。您也可以单击开始并输入(Start and type)Hyper -V(Hyper-V)进行搜索。
配置 Hyper-V
现在是有趣的部分!让我们开始使用Hyper-V。继续(Hyper-V. Go)并打开Hyper-V 管理器(Hyper-V Manager),您将看到一个空白工作区。
最左边是服务器,它应该是您计算机的名称。中间部分是虚拟机和检查点列表。在右侧,您有一个动态菜单,该菜单会根据左侧部分中选择的项目而变化。要开始使用,请选择最左侧的计算机名称(computer name)。
现在在最右边,点击New,然后点击Virtual Machine。这将调出新的虚拟机向导(machine wizard)。第一步是给你的虚拟机一个名字。
接下来,您必须选择虚拟机的世代。如果您要将 64 位版本的Windows转换为虚拟机,并且您的计算机硬件(computer hardware)支持UEFI,请继续选择第 2 代( Generation 2),因为它允许使用更高级的功能。对于 32 位版本的Windows或您的机器使用旧版BIOS ,请使用第 1 代( Generation 1)。在虚拟化Windows(Windows) 8.1 或Windows 10时,第 2 代(Generation 2)还支持宽屏显示 。
如果您不知道这意味着什么,请选择第 1 代(Generation 1)以确保安全。请注意,如果虚拟机无法启动,您可以轻松地将其删除并重新启动此过程。选择不同的一代,看看它是否正确启动。删除Hyper-V(Hyper-V)中的虚拟机不会删除您的原始VHDX文件。
在下一个屏幕上,您必须选择要分配给虚拟机的内存量。我将其保留为默认值(default value)1024 MB,但如果您的主机(host machine)上有足够的可用RAM ,您可以增加它。
继续并暂时跳过配置网络( Configure Networking)屏幕,因为我们稍后必须这样做。现在,只需将其保留在Not Connected即可。在Connect Virtual Hard Disk屏幕上,您需要选择Use an existing virtual hard disk。
单击浏览(Browse)按钮并选择代表您的实际Windows 分区的(Windows partition)VHDX 映像(VHDX image)。这应该是非常大的VHDX 文件(VHDX file)。我们将不得不在向导之后手动添加另外两个VHDX驱动器,我将在下面进一步展示。此时,查看摘要并单击Finish。
现在您应该会在Virtual Machines下看到一个新项目。如果单击此按钮,您还会在右侧窗格(right-hand pane)中看到更多选项。
要启动虚拟机,请选择它,然后单击Start。State列将变为Running。接下来查看虚拟机,单击Connect。如果您现在执行此操作,您将看到我在文章开头提到的错误消息:(error message)启动失败(Boot failure)。我们仍然需要添加其他硬盘。
选择虚拟机并单击(machine and click)关闭( Turn Off)。然后点击设置(Settings)链接。在左侧,(hand side)您应该看到IDE Controller 0和IDE Controller 1。首先单击控制器 0( Controller 0)。如果您选择第 2 代(Generation 2),您将只看到SCSI 控制器(SCSI Controller)。
您将看到我们在向导中添加的第一个VHDX 文件(VHDX file)已经列出。现在我们必须添加第二个和第三个文件。确保(Make)已选择硬盘驱动器(Hard Drive),然后单击添加(Add)。
位置(Location)框应该自动选择1,因为0插槽被我们的第一个VHDX 文件占用(VHDX file)。每个IDE 控制器(IDE Controller)只有两个可用于添加驱动器的插槽。单击(Click) 虚拟硬盘(Virtual hard disk)并选择您的第二个 VHDX 文件。
现在单击IDE Controller 1,然后再次单击Add按钮。在这里做同样的事情,但是选择你的第三个VHDX 文件(VHDX file)。
现在我们已经附加了所有三个VHDX文件,我们可以单击确定并启动我们的虚拟机。这一次你应该希望得到一个加载Windows的屏幕!(Windows)
配置网络
最后,我们需要为虚拟机设置网络,以便您可以连接到本地网络和Internet。为此,请单击右侧菜单顶部的Virtual Switch Manager 。
单击新建虚拟网络交换机(New virtual network switch),然后从列表框中选择(list box)外部(External)。最后,点击Create Virtual Switch。
如果您愿意,可以为您的虚拟交换机命名,然后从下拉框中选择(dropdown box)正确的网络(correct network)。如果您有多个网卡(network card),请选择连接到网络和 Internet(network and Internet)的网卡。创建交换机后,我们需要告诉虚拟机使用它。为此,请单击Hyper-V 管理器(Hyper-V manager)中的虚拟机,然后单击右侧窗格中的设置(Settings)链接。
单击网络适配器( Network Adapter),然后选择您在上一步中创建的新虚拟交换机。而已!现在,当您启动虚拟机时,它应该可以通过主机获得(host computer)网络访问权限(network access)。
希望本文能帮助您将当前的 PC 转换为虚拟机,您可以根据需要在同一台 PC 或另一台 PC 上运行该虚拟机。在此过程中可能会出现很多问题,因此如果遇到问题,请随时发表评论。享受!
Convert a Windows PC into a Virtual Machine using Hyper-V
A great way to save yourself from viruses, malware and spywarе is to use a virtual machinе to browse the Internet instеad of your regular Windows PC. So what is а virtυal machine? It’s basically a full copy of Windows thаt runs inside another copy of Wіndows сalled the host.
The virtual version of Windows is just a large file and special software running on your Windows computer (virtualization software) acts as a fake computer so that Windows can run. Anything you do in the virtual machine will not affect your host operating system. So you could download 10 viruses onto the virtual machine and your main operating system would be safe.
What’s nice about virtual machines is that you can reset them. So if you get a virus while browsing in the virtual machine, you can simply reset the virtual machine to the default state when you first installed it and start over. It’s also a great way to increase your privacy because you can simply erase anything you’ve done in a virtual machine.
Before we get started, let’s talk about the requirements. There are many software virtualization tools out there like VMWare, Parallels, VirtualBox, etc., but I’m going to stick with only Microsoft software. In order for this to work, you need two things:
- Disk2VHD – A free tool from Microsoft that will be used to convert any Windows operating system from Windows XP onwards into a virtual machine file.
- Windows 8.1 Pro or Windows 10 Pro – You’ll need the Pro versions of either Windows 8.1 or Windows 10 in order to complete this process. Both operating systems have a tool called Hyper-V that can be used to access the virtual file created by Disk2VHD.
It’s also worth noting that even though you can use Windows XP, Vista and 7 as the virtual machine, it’s best if you can convert a Windows 8.1 or Windows 10 machine because the highest resolution that Hyper-V supports for those older operating systems is 1600×1200. It’s really annoying and I don’t know why Microsoft hasn’t bothered to fix this issue yet. Anyway, it’s only a problem for those with high resolution monitors.
Convert Windows OS to VHD
Let’s start with the easy part: converting your current version of Windows into a virtual machine (VHD or VHDX file). To do this, download the Disk2VHD tool mentioned above and run the EXE file.
When you run it, you’ll see a screen like the one above. There really isn’t much you have to do here other than choose the location where you want to save the VHDX file and which volumes you want to include.
If you have a large hard drive, you can just let it save the file to the same partition as Windows. If not, choose another location like a second hard drive or an external USB hard drive. By default, it’s going to select all of the volumes it finds on your computer, which may not be want you actually want.
In my case, I have several hard drives connected to the computer, so I only want to select volume C:\, which is 37.26 GB in size. In addition, you want to make sure to select any other volumes that were created when you installed Windows, most likely the Boot volume and System Reserved volume. These are usually really small: in my case, the System Reserved volume is only 34 MB and the other volume, which has no label, is only 322.08 MB.
It’s very important that you select these other volumes in addition to the main Windows volume because if you don’t, the operating system won’t boot when you load it into Hyper-V. Instead, you’ll get a Boot Failure message! This is because those two extra volumes tell the system where Windows is located and how to boot it.
It will probably take some time to create the VHDX file depending on how big your Windows partition is. Once finished, you’ll have one really large file and two smaller files.
Install Hyper-V in Windows 8.1/10
Next, we have to install the Hyper-V tools in Windows 8.1 or Windows 10 Pro. If you have the Home editions, you’ll have to upgrade to Pro before you can install Hyper-V. Click on Start and type in windows features.
At the top, click on Turn Windows features on or off. A window will appear where you can check off extra items you want to install. Go ahead and check the box for Hyper-V. It should automatically check the boxes for Hyper-V Management Tools and Hyper-V Platform also.
Click OK and let Windows install the features. You will also have to restart your computer. Once you boot back up, click on Start, All Apps and then scroll down to Windows Administrative Tools. You should see Hyper-V Manager listed there. You can also just click on Start and type in Hyper-V to search for it.
Configuring Hyper-V
Now for the fun part! Let’s get started with Hyper-V. Go ahead and open the Hyper-V Manager and you’ll see a blank workspace.
At the far left is the server, which should be the name of your computer. In the middle section are the list of virtual machines and checkpoints. On the right, you have a dynamic menu that changes depending on what item is selected in the left-hand sections. To get started, select the computer name at the far left.
Now at the far right, click on New and then Virtual Machine. This will bring up the new virtual machine wizard. The first step is to give your virtual machine a name.
Next, you have to choose the generation for the virtual machine. If you are converting a 64-bit version of Windows to a virtual machine and your computer hardware supports UEFI, go ahead and choose Generation 2, since that allows for more advanced features. Use Generation 1 for 32-bit versions of Windows or if your machine is using legacy BIOS. Generation 2 also supports wide-screen displays when virtualizing Windows 8.1 or Windows 10.
If you have no idea what all that means, just choose Generation 1 to be on the safe side. Note that if the virtual machine fails to boot, you can easily just delete it and start this process again. Select a different generation and see if it boots up properly. Deleting the virtual machine inside Hyper-V does not delete your original VHDX files.
On the next screen, you have to choose the amount of memory you want to assign to your virtual machine. I left it at the default value of 1024 MB, but you can increase it if you have enough RAM available on your host machine.
Go ahead and skip the Configure Networking screen for now because we will have to do that later. For now, just leave it at Not Connected. On the Connect Virtual Hard Disk screen, you need to select Use an existing virtual hard disk.
Click the Browse button and select the VHDX image that represents your actual Windows partition. This should be the really big VHDX file. We will have to manually add the other two VHDX drives after the wizard, which I will show further down. At this point, review the summary and click Finish.
Now you should see a new item listed under Virtual Machines. If you click on this, you’ll see a bunch more options in the right-hand pane also.
To start the virtual machine, select it and then click on Start. The State column will change to Running. Next to view the virtual machine, click on Connect. If you did this now, you’ll see that error message that I mentioned at the beginning of the article: Boot failure. We still need to add the other hard drives.
Select the virtual machine and click Turn Off. Then click on the Settings link. On the left hand side, you should see IDE Controller 0 and IDE Controller 1. Click on the Controller 0 first. If you chose Generation 2, you will see SCSI Controller only.
You will see that the first VHDX file we added in the wizard is already listed. Now we have to add the second and third files. Make sure Hard Drive is selected and then click Add.
The Location box should automatically choose 1 since the 0 slot is taken by our first VHDX file. Each IDE Controller only has two slots available for adding drives. Click Virtual hard disk and choose your second VHDX file.
Now click on IDE Controller 1 and then click the Add button again. Do the same thing here, but choose your third VHDX file.
Now that we have all three VHDX files attached, we can click OK and start up our virtual machine. This time you should hopefully get a screen with Windows loading!
Configure Networking
Lastly, we need to setup networking for the virtual machine so that you can connect to the local network and to the Internet. To do this, click on Virtual Switch Manager at the top of the right hand menu.
Click on New virtual network switch and then select External from the list box. Finally, click on Create Virtual Switch.
Give your virtual switch a name if you like and then choose the correct network from the dropdown box. If you have more than one network card, choose the one that is connected to the network and Internet. Once your switch has been created, we need to tell the virtual machine to use it. To do that, click on the virtual machine in Hyper-V manager and then click on the Settings link in the right pane.
Click on Network Adapter and then choose the new virtual switch that you created in the previous step. That’s it! Now when you start up your virtual machine, it should get network access via the host computer.
Hopefully, this article helps you take your current PC and convert it into a virtual machine that you can run on the same PC or another PC if you like. There are lots of things that can go wrong in this process, so feel free to comment if you run into problems. Enjoy!