VMware Cloud Community
drivera01
Enthusiast
Enthusiast

copy only one of three vmdk's to an alternate datastore

So the following will copy all the vmdk's of a spcific VM, but what I really need is only one specific vmdk. I need to copy a specific vmdk to an alternate datastore.

Get-HardDisk -VM <vm-name> | Copy-HardDisk "[datastore01]/"



Is it possible?


Thanks!!
Reply
0 Kudos
2 Replies
mattboren
Expert
Expert

Hello, drivera01-

Yes, you can specify which hard disk you retrieve by using the -Name parameter on Get-HardDisk (that param was not always available in that cmdlet).  Then, only that hard disk will be passed in the pipeline to the Copy-HardDisk cmdlet, and so only that one hard disk should get copied.  Like:

Get-HardDisk -VM myVM01 -Name "Hard disk 3" | Copy-HardDisk "[datastore01]/"

That do it for you?

Reply
0 Kudos
drivera01
Enthusiast
Enthusiast

That is exactly what I was looking for.!!!  I do have one other question in regards to command format.

I would like to know if there is a space between [datastore01] and the / below. If I put a space the command works, all vmdk's copy, but I also receive an equal amount of error in vcenter. If I do not put a space and place it next to the [] the command plainly fails. I thought it was suppose to be next to without space.

Get-HardDisk -VM <vm-name> | Copy-HardDisk "[datastore01]/" 


Other than my follow-up question... I thank you for the info.. exactly what I need.
Reply
0 Kudos