Update ContentLibrary.psm1

Adding logic incase backing isn't a datastore.
This commit is contained in:
jpgrall
2018-11-30 09:55:46 -06:00
committed by GitHub
parent 971e4aeec7
commit 7c7f8d3fbf

View File

@@ -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)
}
}