Skip to content

Instantly share code, notes, and snippets.

@ilandcloud
Created October 12, 2016 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilandcloud/26c0fe532566cd92b13dec5f8b90ab29 to your computer and use it in GitHub Desktop.
Save ilandcloud/26c0fe532566cd92b13dec5f8b90ab29 to your computer and use it in GitHub Desktop.
# Set up an array for the final report
$report = @()
# Get all vApp from the Org
$vApps = Get-CIVApp
foreach ($vApp in $vApps) {
# Get the metadata key/value pairs for all vApps
$Metadatas = Get-CIMetaData -CIObject $vApp
# Get the individual key/value pairs for each vApp
$StopTime = "Not specified"
$StartTime = "Not specified"
$Day = "Not specified"
$AutoOnOff = "Not specified"
foreach ($Metadata in $Metadatas) {
$Key = ''
$Value = ''
$vAppName = $Metadata.CIObject
$Key = $Metadata.Key
$Value = $Metadata.Value
if ($Key -eq 'StopTime') {$StopTime = $Value}
if ($Key -eq 'StartTime') {$StartTime = $Value}
if ($Key -eq 'Days') {$Day = $Value}
if ($Key -eq 'AutoOnOff') {$AutoOnOff = $Value}
}
$row= " " | select vApp,Days,StopTime,StartTime,AutoOnOff
$row.vApp = $vApp
$row.Days = $Day
$row.StopTime = $StopTime
$row.StartTime = $StartTime
$row.AutoOnOff = $AutoOnOff
# Add this row to the report array
$report += $row
}
# Write out the report array to the file in CSV format
$outfile = "C:\temp\metadata.csv"
$report | Export-Csv $outfile -NoTypeInformation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment