« Hyperv » : différence entre les versions

De Banane Atomic
Aller à la navigationAller à la recherche
 
(8 versions intermédiaires par le même utilisateur non affichées)
Ligne 3 : Ligne 3 :
= Links =
= Links =
* [https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/get-started/create-a-virtual-switch-for-hyper-v-virtual-machines Create a virtual switch by using Windows PowerShell]
* [https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/get-started/create-a-virtual-switch-for-hyper-v-virtual-machines Create a virtual switch by using Windows PowerShell]
* [https://stackoverflow.com/questions/41264525/hyper-v-create-shared-folder-between-host-and-guest-with-internal-network Share folder between host and guest]


= [https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v Activer Hyper-V] =
= [https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v Activer Hyper-V] =
Ligne 20 : Ligne 21 :
|}
|}


= Monter un lecteur hote =
= RDP connection options =
To have more connection options, use the RDP client instead of the hyper-v client.
 
== Multi-screens ==
# Show Options
# Display tab → tick the Use all my monitors for the remote session
 
=== [https://www.hanselman.com/blog/how-to-remote-desktop-fullscreen-rdp-with-just-some-of-your-multiple-monitors Select the screens] ===
<filebox fn='MyVm.rdp'>
# use monitor 1 and 2
selectedmonitors:s:1,2
</filebox>
 
<kode lang='ps'>
# get monitor ids
mstsc /l
</kode>
 
== [https://superuser.com/questions/741435/how-to-enable-remote-microphone-on-remote-desktop Use host microphone] ==
# Show Options
# Local Resources tab → click on the Settings button in the audio configuration
# Remote audio recording → Record from this computer
 
== Monter un lecteur hote ==
# Connect
# Connect
# 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://learn.microsoft.com/en-us/windows-server/administration/windows-commands/mstsc Connect with command line] ==
<kode lang='ps'>
mstsc MyProfile.rdp
</kode>
= [https://www.nakivo.com/blog/essential-hyper-v-powershell-commands/ Command lines] =
<kode lang='ps'>
# list the vm
get-vm
# list the vm with their ip adresses
get-vm  | Select -ExpandProperty Networkadapters
# start / stop a vm
start-vm -name 'My VM'
stop-vm -name 'My VM'
# connect to a VM
vmconnect localhost '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] =
Ligne 46 : Ligne 93 :


REM détacher un vdisk
REM détacher un vdisk
select vdisk
select vdisk file="C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\windows.vhdx"
select vdisk file="C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\windows.vhdx"
detach vdisk
detach vdisk

Dernière version du 27 novembre 2022 à 15:22

Links

Activer Hyper-V

  1. Windows → Turn Windows Features on or off
  2. 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

RDP connection options

To have more connection options, use the RDP client instead of the hyper-v client.

Multi-screens

  1. Show Options
  2. Display tab → tick the Use all my monitors for the remote session

Select the screens

MyVm.rdp
# use monitor 1 and 2
selectedmonitors:s:1,2
Ps.svg
# get monitor ids
mstsc /l

Use host microphone

  1. Show Options
  2. Local Resources tab → click on the Settings button in the audio configuration
  3. Remote audio recording → Record from this computer

Monter un lecteur hote

  1. Connect
  2. Fenêtre Connect to → Show Options
  3. onglet Local Resources → More → Drives → C:

Connect with command line

Ps.svg
mstsc MyProfile.rdp

Command lines

Ps.svg
# list the vm
get-vm
# list the vm with their ip adresses
get-vm  | Select -ExpandProperty Networkadapters

# start / stop a vm
start-vm -name 'My VM'
stop-vm -name 'My VM'

# connect to a VM
vmconnect localhost 'My VM'

# save the vm
save-vm -name 'My VM'

Booter sur une machine virtuelle

Delete checkpoints then disable the checkpoints feature.
Dos.svg
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
Ps.svg
# 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:
  • Windows + RSystemPropertiesAdvanced
  • Windows + Rmsconfig

VHD_BOOT_HOST_VOLUME NOT ENOUGH SPACE

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\FsDepends\ParametersVirtualDiskExpandOnMount = 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
  1. Hyper-V manager - Edit disk
  2. Choose action - compact

WiFi

  1. open Network Connections ncpa.cpl
  2. select both Wi-Fi adapter and Default Switch adapter → right-click → Bridge connections
  3. a Network bridge is created
  4. right-click on Network Bridge → Properties
  5. tick the checkboxes of the 2 adapters

Erreurs

Property ‘MaxInternalSize’ does not exist in class ‘Msvm_VirtualHardDiskSettingData’

Le snapshot ne reconnait plus son parent.

Ps.svg
# essayer une première fois sans IgnoreIDMismatch
Set-VHD "C:\folder\Win10_snapshotId.avhdx" -ParentPath "C:\folder\Win10.vhdx" -IgnoreIDMismatch