diff --git a/Modules/ContentLibrary/ContentLibrary.psm1 b/Modules/ContentLibrary/ContentLibrary.psm1 index d85bd54..9a8574b 100644 --- a/Modules/ContentLibrary/ContentLibrary.psm1 +++ b/Modules/ContentLibrary/ContentLibrary.psm1 @@ -198,8 +198,14 @@ Function Get-ContentLibraryItemFiles { $contentLibraryItemStorageService = Get-CisService com.vmware.content.library.item.storage foreach($file in $files) { - $filepath = $contentLibraryItemStorageService.get($itemId, $($file.name)).storage_uris.AbsolutePath.split("/")[5..7] -join "/" - $fullfilepath = "[$($datastore.name)] $filepath" + if($contentLibraryItemStorageService.get($itemId, $($file.name)).storage_backing.type -eq "DATASTORE"){ + $filepath = $contentLibraryItemStorageService.get($itemId, $($file.name)).storage_uris.AbsolutePath.split("/")[5..7] -join "/" + $fullfilepath = "[$($datastore.name)] $filepath" + } + else{ + $fullfilepath = "UNKNOWN" + } + if(!$LibraryItemName) { $fileResult = [pscustomobject] @{ Name = $file.name; @@ -703,4 +709,4 @@ Function New-VMFromVMTX { Write-Host "`nDeploying new VM $NewVMName from VMTX Template $VMTXName ..." $results = $vmtxService.deploy($vmtxId,$vmtxDeploySpec) -} \ No newline at end of file +}