Open Control Panel - Programs - Turn Windows features on or off - Hyper-V
If the above Hyper-V options are not available in Windows 10 or Windows 11, copy the following code in Notepad and save it as hyper.bat, right-click and run as administrator:
pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt
for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
del hyper-v.txt
Dism /online /enable-feature /featurename:Microsoft-Hyper-V-All /LimitAccess /ALL
After a few minutes of needing to connect to the Internet, enter Y to restart the computer.