Highlighted
Expert
Expert

Moving a given VM to a specified datastore creating thin disks

Jump to solution

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

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Hot Shot
Hot Shot

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

0 Kudos
2 Replies
Highlighted
Hot Shot
Hot Shot

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

0 Kudos
Highlighted
Contributor
Contributor

# Define your variables $VMName + $destDatastore

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