Hi all,
Looking at Exporting Content Library Items to Excel Sheet:
what I'm hoping or looking to do is
Export to Excel to something like the following
vCenter | Cluster | DataStore | Template |
---|---|---|---|
test1 | Test-Cluster | vSAN | Win2016 |
test1 | Test-Cluster | vSAN | Win2019 |
test1 | Test-Cluster1 | vSAN-1 | win2016 |
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
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
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