VMware Cloud Community
Mackopes
Enthusiast
Enthusiast

Trying to get proper VMPathName from VM on VVOL that will work with Copy-DatastoreItem

I'm trying to determine the foldername of a VM via PowerCLI on a VVOL datastore so I can use it to Copy-DatastoreItem.

On a VMFS or vSAN datastore, I can use the $VM.ExtensionData.Summary.Config.VMPathName to extract that and it works perfectly.

With a VM on a VVOL, the result of this is a GUID kinda like this

[VVOL Name] rfc4122.f892834c-0123-34js-kjsdd-323kjsdkfljs/vmname.vmtx

When I try to use that foldername for Copy-DataStoreItem like this:

Copy-DatastoreItem -Item c:\temp\test.txt -Destination vmstore:\vcenter@443\DC\VVOL Name\rfc4122.f892834c-0123-34js-kjsdd-323kjsdkfljs\test.txt

It fails with 'The specified destination folder <folder I attempt to copy to> does not exists.'

If i manually put the real foldername (which 'most' of the time is the VM name, but I don't want to rely on that...), it works fine.

Using PowerCLI 6.5.1

AK

Tags (2)
0 Kudos
0 Replies