I need to get the vVOL folder name of a VM that I am creating. I cant assume that it is the VM name because a folder could have already existing leading to the new VM's folder being VM_1. Unfortunately, because the VM is on a vVOL I cant figure out to return the folder name so that I can query it using the PSDrive commands.
$vm = Get-VM -Name $vmName
$vmConfig = $vm | Get-View | Select-Object -ExpandProperty Config
$vvolPath = $vmConfig.Files.VmPathName
$vvolPath
This returns the RFC1422 path like:
[VVOL_301_POD1] rfc4122.bd198e7c-2f4a-4a32-b7b6-12dcf58ed1aa/snapVM02.vmx
Want to see:
[VVOL_301_POD1] snapVM02/snapVM02.vmx
Thx