path

Change the Default Virtual Machine Path for Hyper-V Hosts

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:\ClusterStorage\VM01 -VirtualMachinePath C:\ClusterStorage\VM01}

If you need to specify a particular cluster, just add -Cluster <name> 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 <cluster> | foreach {Get-SCVMHost -ComputerName $_.Name} | FT Computername, VMPaths -AutoSize
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish