The point of setting up the Windows Server 2016 Hyper-V hypervisor is to host virtual machines. Once you have installed the Hyper-V role, the virtual machine configuration and creation process in Windows Server 2016, 2019 and 2022 is identical. As a result, you can use the same workflow to create and configure a virtual machine (VM) in modern Windows Server operating systems.
When you select Use Dynamic Memory for this virtual machine, you can set minimum and maximum values for the RAM that is dynamically assigned to the VM. You can do it in the virtual machine configuration when a VM is created.
Note: There are some downsides to this approach. While the Hyper-V storage driver generally makes efficient use of resources for optimal performance, you may still prefer to provision thick disks or fixed size in Hyper-V. To do that, you should choose the third option and attach a thick virtual hard disk after your VM is created. Read about the differences between VHD and VHDX.
After connecting to the VMConnect, we should now be able to boot our VM and install the operating system as usual through the operating system installation prompts. After finishing the installation, we have a Windows Server virtual machine. We can edit the windows virtual machine configuration, install applications inside the VM, etc.
ConclusionThe steps for how to create a Windows Server virtual machine in Hyper-V running on Windows Server 2016, 2019 and 2022 can be used to install a VM running any other supported operating system such as Windows 7, Ubuntu Linux, etc.
Using Hyper-V Manager is a convenient method to create a VM and edit the virtual machine configuration. Alternatively, you can create a Hyper-V VM in PowerShell that can be useful for automation and mass deployment. Whatever method to create and set up a VM you use, remember to backup Microsoft Hyper-V VM backup to avoid data loss and downtime.
1 Year of Free Data Protection: NAKIVO Backup & Replication
NAKIVO website uses cookies for the purposes of analytics and to ensure the best browsing experience for the website visitors in accordance with our cookie policy.
You can reject cookies at any time in your browser settings.
Your setup may differ - but I created these directories and placed a copy of the downloaded file here. A copy, because I have re-used the base file on more than one VM and have retained it for future use.
Thanks for doing this. I wish it existed back when I started my Hyper-V journey. One thing to note for any users planning to do an HA installation with Hyper-V is that most Z-Wave controllers are USB and Hyper-V cannot map through a USB port. I found excellent software call USB Redirector that allows you to bring your USB ports over to the VM. If anyone needs help with that, send me a message.
If you have windows server I could also suggest installing docker. Windows server has native support for docker containers. Though you will need a docket enterprise license for that to work. Good news, because Windows Server Standard and Datacenter editions have a free docker enterprise license included (no need to add this anywhere).
I believe with docker it is possible to give the containers usb support (not entirely sure). Had been using hyper-v for 10 years now and I recently switched to esxi as I needed real usb passthrough which as most of you know is not possible with Hyper-V.
Ive managed to deploy Hass.IO into hyper-v and restore my backup. How do i use this USB Re-director to plumb into my Hyper-V hass.io and what needs to be configured on Hass.IO to pick up the USB device >?
Now you should be able to see the devices. You can query using usbclnt -list to see attached devices. If everything worked, you should find a new device in /dev. Mine is called TTYACM0. From here configure OZW using the new device.
Thank you for your briliant manual. I had only one issue during instalation. Active internet connection is required, as usually no virtual pc has access to internet, booting of HomeAsisstant was stuck before any application start and waiting for internet connection without any warning.
Real World Note: Since Windows Vista, there is no technical requirement to create reference images in order to deploy Windows. After all, the ISO that you download from Microsoft contains WIM images that are in a deployable state. The main reason for creating reference images, meaning images with one or more applications in them, is often just deployment speed, and to some extent network efficiency (WIM images are highly compressed). However, in a world with better and better peer to peer solutions, better networking, better hardware, you can make deployments go quite fast even without a reference image. While more and more organizations are moving to use a thin image, and deploy settings and applications at deployment time instead, if you still need a reference image. Here is how to create one.
Due to how aggressive Windows 11 is regarding updating its native applications, which is known for breaking Sysprep, make sure the virtual machine does not have Internet access during the build and capture process.
Tip: Daniel Barras (thank you), commented about a solution I was not aware of, removing the need for blocking Internet access. Please see the discussion in the comments section. The use of state.ini reduces some cleanup options you may want to to do. Also, thanks to Steyrs for providing the below steps:
MDT can be installed either on a file server, or on your own laptop, but in this scenario, I use a file server named MDT01. Deployment of Windows 11 21H2 is only supported using Windows ADK for Windows 11 21H2, that supports both Windows 10 21H2 and Windows 11 21H2, but in my testing I found it working well even on older version of Windows ADK, like the Windows ADK 2004.
2. Once the deployment share is created you also want to relax the security a bit. MDT locks it down to hard by default. Use the following PowerShell script (named Set-MDTBuildLabPermissions.ps1) to set some better permissions (modify script to fit your environment):
Note: In my environment the MDT01 server is joined to a domain, and my service account used for the deployments is VIAMONSTRA\MDT_BA. If using a different domain, or if using a workgroup server for your build and capture modify the Set-MDTBuildLabPermissions.ps1 script to reflect that.
In this example you add Microsoft 365 Apps for enterprise (formerly named Microsoft Office 365 ProPlus) to MDT. Use the Office Deployment Toolkit (ODT) to create a package of Microsoft 365 Apps for enterprise before continuing with these steps.
To configure the deployment settings, you modify the two rules files (Bootstrap.ini and CustomSettings.ini). You can do the either via the MDT Build Lab deployment share properties, or directly in the file system, in the E:\MDTBuildLab\Control folder. Below you find the configurations I used in this guide.
Per the state.ini contributors of this post, Daniel and Steyrs, the state.ini file should be copied to the C:\Windows\setup\state folder during deployment. The state.ini file should look like this per Daniel example:
[State]
ImageState=IMAGE_STATE_SPECIALIZE_RESEAL_TO_OOBE
If you happen to be putting Notepad++ in your images, be warned that version 8.5 and up install a UWP package that will cause Sysprep to fail. The registry key and state.ini will get around the error when capturing, but the image won't deploy correctly.
I've had no issues doing a build and capture of Windows 11 23H2 in MDT as long as it's a Hyper-V Gen 1 (BIOS-based) VM, and Internet access has been blocked during the build and capture process. Here is a simple way to do that: -internet-access-to-a-hyper-v-vm/
The error appears only on UEFI VMs at the execute sysprep step when sysprepping and capturing within VMware. This does not happen on legacy BIOS VMs.
The task sequence should reboot and get back into WinPE, but it is booting back into Windows. This bug is caused by a pending Windows reboot. The sysprep step will reboot the VM, but MDT already set up the VM to reboot into WinPE, so the pending Windows reboot is still there.
This error can be fixed by adding a Restart Computer step just before the Imaging step in State Restore.
Thanks for Article, Johan. I think about Virtual Machine, can I use VirtualBox for alternative from VMware or Hyper-V? My laptop was too potato or low-end for using VM besides VirtualBox. And, Do you think I can do deploying Windows without Virtual Machine and do it in Real Hardware?
I've been looking around the internet but can't find if there is a way to reset "Smart App Control" for these captured images, it was enabled during the time of capture. It kind of looks this is automatically disable if the hardware is not the same source, because I have reimaged to a VM on the same hardware and it was still enabled. If it was "on" during capture, I don't see why this would be an issue to maintained it on the new hardware.
Your milage with the state.ini might vary, I haven't used it much. Blocking Internet access for a VM is usually quite easy. For Hyper-V VMs you can use the Add-VMNetworkAdapterAcl cmdlet to block certain IP adresses.
Sysprep never runs. It just reboots the VM back to a login prompt. The disable Internet script doesn't do anything. The VM has WWW access after first reboot. Neither running a script or entering the command directly disables WWW for the VM. Also, the registry add and state.ini steps don't seem to do anything either. What am I missing?
Ever since 22H2 it seems that the Unattend.xml file is not processed.
I can create and capture fine, but when we go to redploy it once it loads into Windows it doesn't autologin and just stops at the login screen. The password we set for administrator also doesn't work.
I am having an issue where the VM locks up right as sysprep is finishing. It will not reboot to actually capture the image. If I force the VM to shut down and come back up it just loads into windows 11 and does not capture the image. Any thoughts?
d3342ee215