When I copy all the hard disks of VM named "1", it copies all the disk to destination folder named "2" in datastore named "Data", the below command works:-
Get-HardDisk -VM 1 | Copy-HardDisk "[Data] 2/"
BUT
When I try to copy only one particular Disk it errors out as below :-
Get-HardDisk -VM 1 | Copy-HardDisk -HardDisk "[Data] 1/1.vmdk" -DestinationPath "[Data] 2/"
Copy-HardDisk : Cannot bind parameter 'HardDisk'. Cannot convert the "[Data] 1/1.vmdk" value of type "System.String" to type
"VMware.VimAutomation.ViCore.Types.V1.VirtualDevice.HardDisk".
At line:1 char:46
+ Get-HardDisk -VM 1 | Copy-HardDisk -HardDisk "[Data] 1/1.vmdk" -DestinationPath ...
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Copy-HardDisk], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,VMware.VimAutomation.ViCore.Cmdlets.Commands.CopyHardDisk
Any help, thanks