How to Copy an ISO file to Hyper-V Host
Brandon Lee, posted on March 15, 2017
One of the seemingly trivial but equally important tasks we need to think about when creating a new virtual machine in Hyper-V is installing an operating system. Generally, this is done by mounting an ISO installation image of the operating system media. How do we get that media to our Hyper-V host so that we can mount it for installation? We need to copy the media up to the host.
The process to copy our ISO file to Hyper-V host is fairly simple. The easiest way to get the ISO file to our Hyper-V host is to allow file and print sharing firewall rules, copy our ISO file to the host, and then disable file and printer sharing in the firewall rules of our Hyper-V host firewall if we choose. To enable file and printer sharing in the firewall, run the following command on the Hyper-V host.
netsh advfirewall firewall set rule group=”File and Printer Sharing” new enable=Yes
To copy over the ISO file, we can simply map a network drive to our Hyper-V host. If we want to copy the ISO file to a folder on the D:\ drive on our host, we can simply map a network drive to the D$ admin share.Net use * \\〈your hyper-v host〉\d$
Once, you are connected to the Hyper-V drive share, you can create a folder for the ISOs if you want. In the test environment below, a folder called ISOs has been created. Now you can simply copy and past ISO images to the newly created folder.
After we have copied the ISO image to the server, as you can see on the guest virtual machine below, we can point the DVD Drive to the Image file and browse to our folder that we created on the root of the D: drive.
Finally, we can disable the file and printer sharing firewall rules we allowed above if we choose to do that by simply changing our “Yes” to a “No”.netsh advfirewall firewall set rule group=”File and Printer Sharing” new enable=No
Having ISO media for use in installing our guest operating system is perhaps the easiest way to quickly access the installation files. With Hyper-V we can change our firewall rules to allow us to copy files to a chosen installation folder, copy the ISO to the server, and then we can point the DVD drive of the guest virtual machine to use the ISO image file located in the directory we created containing our ISO image.