Share via


Enabling the Hyper-V role during a task sequence while avoiding the reboots

When enabling the hyper-v role during a task sequence,  using ServerManagerCMD.exe the role requires a reboot... well actually 2 reboots. This causes problems with the task sequence. The task sequence will handle the first reboot fine but when the machine comes back up it will reboot the machine outside of the task sequence's control. There are a number of other ways that you can enable the Hyper-V role, which are outlined in this blog. As this blog points out there are several problems using a number of these solutions for setting the Hyper-V role in a task sequence.

The best way that I have found to set the Hyper-V role in a task sequence is to run Dism to install the role. During the task sequence after the image has been applied and prior to running the setup and Config Mgr step run the following:

 cmd /c Dism.exe /image:%OSDTargetDrive%\ /Enable-Feature /FeatureName:Microsoft-Hyper-V /LogPath:%_SMSTSLogPath%\Hyper-V.log

 

After this step has finished run the following:

 cmd /c Dism.exe /image:%OSDTargetDrive%\ /Enable-Feature /FeatureName:Microsoft-Hyper-V-Management-Clients /LogPath:%_SMSTSLogPath%\Hyper-Vclient.log

In the above commands %OSDTargetDrive% is the volume that the image was applied to and Dism will treat this an offline image. %_SMSTSLogPath%, where the DISM log will be written, is the same location that the task sequence log will be written to.

Comments

  • Anonymous
    January 01, 2003
    The comment has been removed