2

I have a virtual machine running at my local machine in Hyper-V and need to move this VM to the cloud. I have received an advise to use https://vultr.com to do this since not all of the users have access to Microsoft DevOps. I need to create an ISO image from the VM to add it to vultr.com. Alas, it seems to be quite hard to create an ISO. Please, can anyone tell me how to make the ISO? I think that I don't need sysprep, since the existing VM will not be used anymore. The VM is a copy from Production, so I don't want to change too much.

I have read Creating an ISO from a Hyper-V Machine but couldn't find my answer in that topic. Or I didn't understand it.

Leonard
  • 41
  • 1
  • 6

1 Answers1

2

An ISO can be created natively by installing the Windows ADK and using oscdimg, otherwise, any 3rd party program could be used (for example, Alcohol 120%).

  • You may wish to first compress the VHD into a 7z or zip archive first via 7zip, then create an ISO of a directory containing just the archive.

oscdimg

  1. Install: Windows ADK (8 & 10) || AIK (7)
    1. ADK:
    2. AIK:
      • Windows <=7 Windows AIK
        • Run: StartCD.exe > Windows AIK Setup

  2. oscdimg –n –d –m "source" "target.iso"`
    
    • -n: Permits file names longer than DOS 8.3 file names
    • -d: Permits lower case file names
    • -m: Ignores the maximum size limit of an image
    • source: Directory containing VHD file
    • target: ISO file

      Example:

      PS $  oscdimg -n -d -m ".\Shared" ".\Shared.iso"
      
        Scanning source tree
        Scanning source tree complete (1 files in 1 directories)
      
        Computing directory information complete
      
        Image file is 4701857792 bytes
      
        Writing 1 files in 1 directories to ".\Shared.iso"
      
        100% complete
      
        Final image file is 4701857792 bytes
      
        Done.
      
      
      PS $  ls
      
            Directory: "V:\VM\Hyper-V\VHDs\Data"
      
        Mode                LastWriteTime            Length Name
        ----                -------------            ------ ----
        d-----        2019.11.14 08:12:09                   Shared
      
        -a----        2019.09.07 08:33:17     4,701,814,784 Shared.vhdx
        -a----        2019.11.14 08:08:35       639,322,915 Shared.vhdx.7z
      
        -a----        2019.11.14 07:50:25     4,701,857,792 Shared.iso
        -a----        2019.11.14 08:08:35       639,322,915 Shared.vhdx.7z.iso
      
JW0914
  • 7,052
  • 7
  • 27
  • 48
  • I share the same reservations about this answer as you do, I suspect this will create a WinPE environment, which isn't what the author wants. DISM can be used to create an install.wim from an existing installation but that process while not difficult is not for the inexperienced. [This](https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/create-a-wim-for-multiple-architecture-types-using-dism) and [this](https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/capture-and-apply-windows-using-a-single-wim) explain that process. – Ramhound Nov 14 '19 at 13:32
  • @Ramhound After some testing, `oscdimg` can't create an ISO from a single file, but it will create an ISO of the folder the VHD file is in. I've updated my answer accordingly. I contemplated adding the recommendation to simply mount and WIM the VHD, however I'm assuming it contains more than just the system partition, so I thought that might over-complicate things. – JW0914 Nov 14 '19 at 14:06
  • Thanks for the reply, which I am about to read and test. The VHDX contains a full Windows Server installation. It contains two partitions (350MB NTFS System Reserved and 250GB NTFS data partition and 14MB unallocated). – Leonard Nov 15 '19 at 10:10
  • As both ISO and VHDX can be regarded as being an archive, I think I don't need to add the VHDX to an ISO, but to add the contents of the VHDX into the new ISO file. If I understand your answer correctly, what you are now suggesting is the former, while I think I need the latter. – Leonard Nov 15 '19 at 12:58
  • @Leonard If you intend to have this be bootable as a VM on Hyper-V, compress the `.vhdx` file to a `7z` or `zip` archive, then create an ISO of the archive, which can be uncompressed & booted once uploaded. If you want to be able to boot the ISO, you will need to WIM the system partition and configure the `BootMgr` to boot the WIM _(i.e. WIMboot, which isn't meant to be used for servers, but thin clients with a limited amount of SSD storage)_. Your question implies you're having an issue with the upload medium [the ISO], of which is just a means to an end and is not meant to be booted from. – JW0914 Nov 15 '19 at 13:08
  • I need to boot the ISO. I have an environment locally in Hyper-V, but it needs to be transferred to an online environment which I can create by uploading an ISO file which should be bootable. – Leonard Nov 15 '19 at 14:18
  • @Leonard That makes everything clearer (please also add that to your question =] ). I have no experience with Windows' Server editions, but with non-server editions, you would boot from an ISO in a similar way a Windows install ISO does... by having the boot directories/files within the root of the ISO and the system partition in WIM format as a WIMboot configuration, however AFAIK, WIMboot is only used for thin-clients, as there are caveats to it that would likely not be desirable for a server OS. – JW0914 Nov 15 '19 at 15:23
  • @Leonard [This](https://docs.microsoft.com/en-us/windows/win32/w8cookbook/windows-image-file-boot--wimboot-) explains the basics of WIMboot, and [this](https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/compact-os) provides some additional contextual information that may be helpful. At this point, I would recommend asking your question on the [Spiceworks forum](https://community.spiceworks.com/), as most forum members work in IT and systems management-related fields, combined with dedicated Microsoft [vendor] employees who monitor for forum questions related to them. – JW0914 Nov 15 '19 at 15:27