سلام دوست عزیزاین راه رو رفتین ؟
How it works?
Almost the whole process to create the USB stick with Hyper-V 2012 R2 is done via commands.
1. The first thing was to create a new VHDX file and enable it to receive the Hyper-V 2012 R2 image by creating a primary partition and formatting it using NTFS.
2. Then, by using the DISM tool, you actually apply the Hyper-V 2012 R2 Server image that is in the Install.wim file to the VHDX file mounted on the R drive.
3. After that, the USB flash drive was prepared and formatted via Diskpart. The VHDX file containing the Hyper-V 2012 R2 image was copied onto it and it was configured with the boot configuration using the BCDBoot tool.
4. The last commands removed the paging file to improve the USB stick performance.
5. That’s it. In the first USB boot, you will have to finish the Hyper-V 2012 R2 Server installation process.
I use this option for all my sessions when I want to demonstrate the features and how powerful is Hyper-V 2012 R2. My daily desktop is Windows 8.1 Enterprise (with hyper-V enable). It’s not recommend to have this installation on any other server that you may use for production environment or even for any other environment that will request sensitive data (like Testing).
How to install Hyper-V 2012 R2 Server on USB Stick
The following steps will show how to prepare a USB flash drive to create a bootable version of
Microsoft Hyper-V 2012 R2 Server.
1. Open the command prompt as an administrator to create the VHDX file that will be used to add the Hyper-V image on the USB stick.
2. Run the following commands to create a folder named HYPVBOOT and the VHDX file named HYPV2012R2.VHDX with 6 GB capacity. The command will also attach the VHDX as the local letter R.
mkdir c:\hypvboot
diskpart
create vdisk file=c:\hypvboot\HYPV2012R2.vhdx maximum=6000 type=fixed
select vdisk file=c:\hypvboot\ HYPV2012R2.vhdx
attach vdisk
create partition primary
assign letter=r
format quick fs=ntfs label=HYPV2012R2
exit
3. After creating the VHDX file, you can apply the Hyper-V 2012 R2 Server image using the INSTALL.WIM file. From the following command change <architecture> to AMD64 or IA64, based on the architecture you want to create and then boot your USB stick. Change <path to wim > to the INSTALL.WIM file path.
cd /d “c:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\<architecture>\DISM”
dism.exe /apply-image /Imagefile: <path to wim> /Index:1 /ApplyDir:R:\
4. Using the diskpart tool you have to detach the virtual disk from your computer using the following command lines:
diskpart
select vdisk file=c:\hvpvboot\HYPV2012R2.vhdx
detach vdisk
exit
5. Now you can attach the USB stick you want to use to be formatted and to receive the VHD file created in the previous steps.
6. Use the diskpart tool again to identify the USB stick disk number.
diskpart
list disk
7. Use the following commands to create and format a new partition and assign the letter Z to the USB stick. Replace <USB Stick number> with the number identified in the previous task.
select disk <USB stick number>
clean
create partition primary
select partition 1
active
format quick fs=ntfs
assign letter=v
exit
8. Copy the VHDX file created in step 2 to the V: drive where the USB stick is attached.
9. Use the Bootsect tool to update the master boot code. From the following command, change <architecture> to AMD64 or IA64, based on the architecture that you want to create. Boot your USB stick.
cd /d ” c:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\<architecture>\BCDBoot”
bootsect /nt60 v: /force /mbr
10. Use the diskpart tool again to attach the VHDX file to the Z drive.
diskpart
select vdisk file=v:\HYPV2012R2.vhdx
attach vdisk
exit
11. Use the BCDBoot tool to copy the necessary boot files so that you can boot your USB stick.
bcdboot r:\windows /s v:
12. As you are installing Hyper-V Server on a USB flash drive rather than a normal hard drive, you have to disable the paging file. Use the following command to load the registry from the VHDX file:
reg load HKLM\HyperVTemp r:\windows\system32\config\system
13. Remove the page file value from the registry with the following command:
reg add “HKLM\HyperVTemp\ControlSet001\Control\Session Manager\Memory Management” /v PagingFiles /t REG_MULTI_SZ /d “” /f
14. Delete the page file entry with the following command:
reg delete “HKLM\HyperVTemp\ControlSet001\Control\Session Manager\Memory Management” /v ExistingPageFiles /f
15. Unload the temporary registry with the following command line:
reg unload HKLM\HyperVTemp
16. Type the following commands to detach the VHD file from the Z drive:
diskpart
select vdisk file=z:\HYPV2012R2.vhdx
detach vdisk
exit
17. Now you can remove the USB stick from your computer and attach it onto another computer to boot Hyper-V 2012 R2 Server.
NOTE: You may need to change the boot order or the boot configuration from your computer BIOS to allow it to boot from USB.
18. At the first bootup, your bootable Hyper-V will be loaded and the system will prompt you to add the new administrator password. Type the new password twice and click on OK.
19. After the first login, Hyper-V will load the SConfig tool, allowing you to change the most common settings using a friendly command-line interface.
20. Now you can set up your Hyper-V Server and enable remote administration to manage it, using Hyper-V Manager from another computer.