VMware Cloud Community
Daithi_N
Enthusiast
Enthusiast

List out Templates within a Content Library

Hi all,

Looking at Exporting Content Library Items to Excel Sheet:

what  I'm hoping or looking to do is

  • Loop over Each Cluster
    • See if The Datastore within the Clusters are Link to a Content Library:
      • Using Get-ContentLibraryItem -> List out the Template Name

Export to Excel to something like the following

vCenter
ClusterDataStore
Template
test1Test-ClustervSANWin2016
test1Test-ClustervSANWin2019
test1Test-Cluster1vSAN-1win2016
Reply
0 Kudos
3 Replies
LucD
Leadership
Leadership

I'm not sure what the question actually is.
You seem to have all the components.
For writing to Excel, do you mean a CSV or an XLSX file.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
Daithi_N
Enthusiast
Enthusiast

List out to an XLSX file

This is what I have seems, but not exporting

$cred = Get-Credential

#Connect to vCenter

Connect-VIServer -Server $server -Credential $cred

ForEach-Object -Process {

    Get-ContentLibrary -PipelineVariable $content |

        ForEach-Object -Process {

            Get-ContentLibraryItem -ContentLibrary $content.Name -PipelineVariable $temp |

           

            Select @{N='ContentLibrary';E={$content.Name}},

                   @{N='DataStore';E={$content.Datastore}},

                   @{N='Template';E={$temp.Name}}

            }

            } | Export-Csv -Path C:\Scripts\Report126.csv -NoTypeInformation -UseCulture

Reply
0 Kudos
LucD
Leadership
Leadership

For an export to XLSX you would need the the Export-Excel cmdlet.
That comes with the ImportExcel module, available on the PowerShell Gallery.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos