You can migrate a virtual machine between datastores using the VMware Storage vMotion feature of vSphere.

Note

You can use VMware Storage vMotion to move a powered-on virtual machine from one datastore to another.

Connect to a vSphere server.

The host on which the virtual machine is running must have access both to the datastore where the virtual machine is located and to the destination datastore.

Get the VM1 virtual machine and move it to a datastore named DS2:

Get-VM VM1 | Move-VM -Datastore DS2