installing the Hyper-V Role is straightforward on a new system, I have seen couple of scenarios where the Hyper-V role will fail on installation. Scenario conditions are outlined below:
- Fresh install of Windows 2012R2 Server.
- All Windows Updates applied then rebooted.
- Post reboot, Hyper-V Role was installed.
- Rebooted machine to finalize installation of role
- Machine begins applying, gets to 99%, then fails to install the Hyper-V role. Windows performs rollback.
Resetting Windows Registry Files To Fix Hyper-V Role
The fix that worked for us was to open up a Command Prompt and select Run As Administrator (or create a batch file and run as an administrator) with the following text.
sc config winmgmt start= disabled net stop winmgmt /y %systemdrive% cd %windir%\system32\wbem for /f %s in ('dir /b *.dll') do regsvr32 /s %s regsvr32 %windir%\system32\tscfgwmi.dll wmiprvse /regserver net start winmgmt for /f %s in ('dir /b *.mof *.mfl') do mofcomp %s cd C:\Windows\System32\wbem\AutoRecover for /f %s in ('dir /b *.mof *.mfl') do mofcomp %s
After the commands above have been executed, the following should now run successfully:
- Install the Hyper-V Role
- Reboot the machine
- Hyper-V will now successfully apply