Skip to content

Instantly share code, notes, and snippets.

@manciuszz
Last active December 30, 2023 13:27
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save manciuszz/dd6a127f426202a2d0db7fc590f82597 to your computer and use it in GitHub Desktop.
Save manciuszz/dd6a127f426202a2d0db7fc590f82597 to your computer and use it in GitHub Desktop.
Windows 10 Home | Hyper-V Management scripts

NOTE:

Installing Hyper-V is easy, but removing it is a hassle...

Disabling Hyper-V first inside Windows Features, restarting and then launching the uninstall batch script does seem to delete most of the stuff, but the Hyper-V services are still there, so you might want to disable them manually inside 'services.msc'...

Anyways, a better move altogether would be to repair the Windows 10 image by doing something like this https://community.spiceworks.com/posts/6576482 or https://www.windowscentral.com/how-use-dism-command-line-utility-repair-windows-10-image

@echo off
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
@echo off
echo DO NO NOT EXECUTE THIS SCRIPT UNTIL YOU UNCHECK 'Hyper-V' FROM 'Windows Features' FIRST!!!
pause
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 /remove-package:"%SystemRoot%\servicing\Packages\%%i"
del hyper-v.txt
Dism /online /disable-feature /featurename:Microsoft-Hyper-V -All /LimitAccess /ALL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment