VMware Cloud Community
MariusRoma
Expert
Expert
Jump to solution

Moving a given VM to a specified datastore creating thin disks

I apologize for the very basic question.

Can anybody please provlde a working sample of a PowerCLI command line to move a given VM (le't's say, "MY VM Sample" with spaces in the name) from a given datastore (let's say, "Source_datastore", should I specify it?) to a given datastore (let's say, "Target_datastore") creating thin disks?

Regards

marius

Reply
0 Kudos
1 Solution

Accepted Solutions
DZ1
Hot Shot
Hot Shot
Jump to solution

Get-VM "VM Name" | Move-VM -Datastore ( Get-VMHost 'HostName' | Get-Datastore -Name "DatastoreName"  ) -DiskStorageFormat Thin

You could just specify the datastore without having to get the VMhost first, but if you have multiple clusters with the same datastores names, it may not pull the correct one.

View solution in original post

Reply
0 Kudos
2 Replies
DZ1
Hot Shot
Hot Shot
Jump to solution

Get-VM "VM Name" | Move-VM -Datastore ( Get-VMHost 'HostName' | Get-Datastore -Name "DatastoreName"  ) -DiskStorageFormat Thin

You could just specify the datastore without having to get the VMhost first, but if you have multiple clusters with the same datastores names, it may not pull the correct one.

Reply
0 Kudos
VM_
Contributor
Contributor
Jump to solution

# Define your variables $VMName + $destDatastore

Move-vm -vm $VMName -datastore $destDatastore -DiskStorageFormat Thin