Configuring VM and storage movement

Hyper-V enables you to move VM details and VM storage to a new location. Moving a VM and moving a VM's storage are two important features you can use to manage your Hyper-V hosts.

Getting ready

In this recipe, you are going to move configuration details for the PSDirect VM within the HV1 server. Then, you move the entire VM to another server, HV2, and view the results. The two Hyper-V servers, HV1 and HV2, were set up in the Installing and configuring the Hyper-V recipe. The VM, PSDirect, was created in the Create a virtual machine recipe.

How to do it...

  1. View the PSDirect VM on HV1 and verify that it is turned off:
    Get-VM -Name PSDirect -Computer HV1
  2. Get the VM configuration location:
    (Get-VM -Name PSDirect).ConfigurationLocation ...

Get Windows Server 2019 Automation with PowerShell Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.