I discovered something interesting, but not sure the fix yet. Per your code from earlier
$oDevice.Backing.FileName = "[$($CLib.Datastore)] contentlib-$($CLib.Id)/$($VMiso.Id)/$($VMiso.Name).$($VMiso.ItemType)"
to build out the actual path to the iso from a datastore point of view, the output were
PS C:\Users\Administrator> echo $CLib.Datastore
Name FreeSpaceGB CapacityGB
---- ----------- ----------
SSD_VM 70.388 223.500
PS C:\Users\Administrator> echo $CLib.Id
e46c6898-9ecc-4fcd-8145-8639bfc7611f
PS C:\Users\Administrator> echo $VMiso.Id
b835b797-a146-4c10-bcbc-537b74e6eb4a
PS C:\Users\Administrator> echo $VMiso.Name
en_sql_server_2016_standard_x64_dvd_8701871
PS C:\Users\Administrator> echo $VMiso.Itemtype
iso
So the code should stitch together the following value
[SSD_VM] contentlib-e46c6898-9ecc-4fcd-8145-8639bfc7611f/b835b797-a146-4c10-bcbc-537b74e6eb4a/en_sql_server_2016_standard_x64_d
vd_8701871.iso
However, when I manually attach the iso through the GUI by using the datastore path (not content library), and I reparse the vm.extensiondata manual, I got the following
[SSD_VM] contentlib-e46c6898-9ecc-4fcd-8145-8639bfc7611f/b835b797-a146-4c10-bcbc-537b74e6eb4a/en_sql_server_2016_standard_x64_d
vd_8701871_1900ce00-de5c-4b91-a526-2af7057ddc3f.iso
the name of the iso actually change after I uploaded it. It is masked if I try to view from the content library , but it is clearly visible (I also confirmed) if you view it from the datastore view. So the question is what is this extra data (metadata? ID?) '1900ce00-de5c-4b91-a526-2af7057ddc3f' come from?