« Hyperv » : différence entre les versions
Apparence
Ligne 24 : | Ligne 24 : | ||
# Fenêtre Connect to → Show Options | # Fenêtre Connect to → Show Options | ||
# onglet Local Resources → More → Drives → C: | # onglet Local Resources → More → Drives → C: | ||
= [https://www.nakivo.com/blog/essential-hyper-v-powershell-commands/ Command lines] = | |||
<kode lang='ps'> | |||
# list the vm | |||
get-vm | |||
# start / stop a vm | |||
start-vm -name 'My VM' | |||
stop-vm -name 'My VM' | |||
# save the vm | |||
save-vm -name 'My VM' | |||
</kode> | |||
= [https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/boot-to-vhd--native-boot--add-a-virtual-hard-disk-to-the-boot-menu Booter sur une machine virtuelle] = | = [https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/boot-to-vhd--native-boot--add-a-virtual-hard-disk-to-the-boot-menu Booter sur une machine virtuelle] = |
Version du 8 mars 2022 à 08:25
Links
Activer Hyper-V
- Windows → Turn Windows Features on or off
- Cocher Hyper-V
Dossiers
Virtual machine configuration folder | C:\ProgramData\Microsoft\Hyper-V |
Checkpount store | C:\Users\Public\Documents\Hyper-V\Virtual hard disks |
Smart Paging folder | C:\Users\Public\Documents\Hyper-V\Virtual hard disks |
Storage folder | C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks |
Monter un lecteur hote
- Connect
- Fenêtre Connect to → Show Options
- onglet Local Resources → More → Drives → C:
Command lines
# list the vm
get-vm
# start / stop a vm
start-vm -name 'My VM'
stop-vm -name 'My VM'
# save the vm
save-vm -name 'My VM'
|
Booter sur une machine virtuelle
![]() |
Delete checkpoints then disable the checkpoints feature. |
REM lancer diskpart
diskpart
REM before having attached the vdisk
list volume
REM ajouter le fichier vhdx
select vdisk file="C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\windows.vhdx"
attach vdisk
REM after having attached the vdisk
list volume
REM changer la lettre de montage
select volume 3
assign letter=v
REM détacher un vdisk
select vdisk file="C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\windows.vhdx"
detach vdisk
|
# ajouter une nouvelle entrée au boot menu
bcdboot V:\Windows /d
# /d keep current OS default at boot
# connaître l'id ("{default}" et "{current}" désignent les OS par défaut et courant)
bcdedit /v
# changer la description
bcdedit /set "{id}" description "Windows 10 (VHDX)"
# changer l'entrée par défaut
bcdedit /default "{id}"
# ne plus afficher le boot menu
bcdedit /timeout 0
# supprimer une entrée
bcdedit /delete "{id}"
|
![]() |
Configurer le boot menu:
|
VHD_BOOT_HOST_VOLUME NOT ENOUGH SPACE
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\FsDepends\Parameters → VirtualDiskExpandOnMount = 4
Limitations
- Native VHDX boot does not support hibernation of the system, although sleep mode is supported.
- Windows BitLocker Drive Encryption cannot be used to encrypt the host volume that contains VHDX files that are used for native VHDX boot.
- The parent partition of a VHDX file cannot be part of a volume snapshot.
- An attached VHDX can't be a dynamic disk.
Compact
Squeeze the empty bits out to reduce the amount of space consumes on host physical disk. It doesn't reduce the capacity of the guest disk.
Prerequisites:
- defrag the drive
- does not work on fixed VHDX
- virtual hard disk has to be NTFS formatted
- Hyper-V manager - Edit disk
- Choose action - compact
WiFi
- open Network Connections ncpa.cpl
- select both Wi-Fi adapter and Default Switch adapter → right-click → Bridge connections
- a Network bridge is created
- right-click on Network Bridge → Properties
- tick the checkboxes of the 2 adapters
Erreurs
Property ‘MaxInternalSize’ does not exist in class ‘Msvm_VirtualHardDiskSettingData’
Le snapshot ne reconnait plus son parent.
# essayer une première fois sans IgnoreIDMismatch
Set-VHD "C:\folder\Win10_snapshotId.avhdx" -ParentPath "C:\folder\Win10.vhdx" -IgnoreIDMismatch
|