Change the Default Virtual Machine Path for Hyper-V Hosts

Change the default Hyper-V storage location for all Hyper-V hosts in a cluster.

John Savill

April 10, 2014

1 Min Read
path

Q: How can I change the default path for virtual machines on all Hyper-V hosts in my cluster?

A: If you've changed the storage configuration on the Hyper-V hosts in your cluster and want to change the default virtual machine (VM) and storage paths, you can use Windows PowerShell to easily accomplish this task. To view the current configuration, enter the following PowerShell command:

Get-ClusterNode | foreach {Get-VMHost -ComputerName $_.Name} | ft ComputerName,VirtualHardDiskPath,VirtualMachinePath -AutoSize

You can then set the new values:

Get-ClusterNode | foreach {Set-VMHost -ComputerName $_.Name -VirtualHardDiskPath C:ClusterStorageVM01 -VirtualMachinePath C:ClusterStorageVM01}

If you need to specify a particular cluster, just add -Cluster to the Get-ClusterNode command.

As a side note, if you just want to list all the VMs in alphabetical order, use the following command:

Get-ClusterNode | foreach {Get-VM -ComputerName $_.Name}| sort-object Name | ft Name, Path, ConfigurationLocation, ComputerName -autosize

Remember that System Center Virtual Machine Manager (VMM) has its own configuration. You can view the VMM defaults, which are based on the available Cluster Shared Volumes (CSV). For example:

Get-ClusterNode -Cluster  | foreach {Get-SCVMHost -ComputerName $_.Name} | FT Computername, VMPaths -AutoSize

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like