This function copies data from one virtual disk to another, converting (disk type, size, hardware) as specified.

vixError = VixDiskLib_Clone(appGlobals.connection, appGlobals.diskPath, srcConnection, 
              appGlobals.srcPath, &createParams, CloneProgressFunc, NULL, TRUE);

Due to a vSphere 6.5 security enhancement, VixDiskLib_Clone() can no longer clone local disks to remote disks that do not belong to any VM. Previous releases allowed use of a retained username and password, but now enhanced security verification is required. The procedure for VixDiskLib_Clone() to make a remote connection is first to get an NFC ticket from the ESXi host based on the MoRef of the VM that manages the cloned-to disks. Then build an authenticated NFC connection to the host using that ticket. The MoRef of the VM must be specified in vmxSpec of the remote connection parameter passed to VixDiskLib_Clone(). The VM must be powered off, and the target disks must already exist before cloning, not necessarily with the same names. Afterwards the VM may be removed from the inventory with UnregisterVM, but it must remain on the datastore with its cloned virtual disks.