Skip to content

Instantly share code, notes, and snippets.

@divyang4481
Created May 27, 2020 17:00
Show Gist options
  • Select an option

  • Save divyang4481/d9a20e81bde304e538367340dfa8a56b to your computer and use it in GitHub Desktop.

Select an option

Save divyang4481/d9a20e81bde304e538367340dfa8a56b to your computer and use it in GitHub Desktop.
------------------------------
Steps
------------------------------
1. Create new text file named "HYPER-V Package Installer" (or whatever) somwhere in your files.
2. Copy text below:
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
3. Rename file extension from ".txt" to ".bat"
4. Right click -> Run as administrator
------------------------------
Explanation
------------------------------
1.) Look for Hyper V Packages
The Script looks into the Folder %SystemRoot%\servicing\Packages\ and search for the Hyper-V-Packages and writes them into a TextFile (hyper-v.txt)
2.) Add Hyper Packages
For each line (Hyper-V-Package) its execute “dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\[Hyper-V-Package]”
3.) Delete hyper-v.txt
4.) Enable Hyper V Feature
Execute Dism /online /enable-feature /featurename:Microsoft-Hyper-V-All /LimitAccess /ALL
@divyang4481
Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment