How to Change Default Folder to Store Hyper-V Virtual Hard Disks


Hyper-V enables running virtualized computer systems on top of a physical host. These virtualized systems (aka: guests) can be used and managed just as if they were physical computer systems, however they exist in a virtualized and isolated environment.

A virtual machine in Hyper-V consists of a few files that account for its virtual hardware configuration and the virtual storage (VHD and VHDX files). By default:
  • The virtual machine configuration files are stored in "C:\ProgramData\Microsoft\Windows\Hyper-V".
  • The virtual hard drives are stored in "C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks".

When you create a virtual machine in Hyper-V Manager, you are able to select to use these default locations or specify a folder location on a per virtual machine basis.

If you like, you could change these global default locations within your hosts to make it easier to use your locations by default instead when creating new virtual machines.

This tutorial will show you how to specify the default folder to store virtual machine hard disk files when importing or creating a new Hyper-V virtual machine in Windows 10.

You must be signed in as an administrator to be able to change the default folder for Hyper-V virtual machine configuration files.


 CONTENTS:

  • Option One: To Change Default Hyper-V Virtual Hard Disks Folder using Hyper-V Manager
  • Option Two: To Change Default Hyper-V Virtual Hard Disks Folder using PowerShell


EXAMPLE: Hyper-V Virtual Hard Disks folder
Change Hyper-V Virtual Hard Disks Folder in Windows 10-virtual_hard_disks.png





OPTION ONE

To Change Default Hyper-V Virtual Hard Disks Folder using Hyper-V Manager


1. Open Hyper-V Manager.

2. Select the Hyper-V host (ex: "BRINK-DESKTOP") in the left pane you want to change the default folder to store Hyper-V virtual machines for, and click/tap on Hyper-V Settings in the right Actions pane. (see screenshot below)

Change Hyper-V Virtual Hard Disks Folder in Windows 10-hyper-v_settings.png

3. Click/tap on Virtual Hard Disks in the left pane, click/tap on the Browse button on the right, navigate to and select the folder you want to use, click/tap on Select Folder, and click/tap on OK. (see screenshots below)

Change Hyper-V Virtual Hard Disks Folder in Windows 10-hyper-v_virtual_hard_disks.png

4. When finished, you can close Hyper-V Manager if you like.






OPTION TWO

To Change Default Hyper-V Virtual Hard Disks Folder using PowerShell


Note   Note
For more details about the Set-VMHost command used in this option, see: Set-VMHost


1. Open an elevated PowerShell.

2. Type the command you want to use below into the elevated PowerShell, and press Enter. (see screenshot below)

(Current Hyper-V host)
Set-VMHost -VirtualHardDiskPath 'Full path of folder'

OR

(Specific Hyper-V host)
Set-VMHost -ComputerName 'Hyper-V host name' -VirtualHardDiskPath 'Full path of folder'

Note   Note
Substitute Full path of folder in the commands above with the actual full path of the folder you want to store Hyper-V virtual machine hard disks in.

Substitute Hyper-V host name in the second command above with the actual host name (ex: "BRINK-DESKTOP') you want to change the default virtual hard disks folder for.

For example:

Set-VMHost -VirtualHardDiskPath 'D:\Virtual Machines'

OR

Set-VMHost -ComputerName 'BRINK-DESKTOP' -VirtualHardDiskPath 'D:\Virtual Machines'


Change Hyper-V Virtual Hard Disks Folder in Windows 10-hyper-v_virtual_hard_disks_powershell-1.png
Change Hyper-V Virtual Hard Disks Folder in Windows 10-hyper-v_virtual_hard_disks_powershell-2.png

3. When finished, you can close PowerShell.


That's it,
Shawn