Skip to content

Instantly share code, notes, and snippets.

@adamrushuk
Last active July 16, 2016 11:13
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 adamrushuk/ca8f5d4ab7f29cb7d6b0288beb3480db to your computer and use it in GitHub Desktop.
Save adamrushuk/ca8f5d4ab7f29cb7d6b0288beb3480db to your computer and use it in GitHub Desktop.
# Author: Adam Rush
# Created on: 2016-05-28
# Finds all upgradeable vShield Edges and exports CSV file to Desktop
$reportPath = "$HOME\Desktop\upgradable-VSEs.csv"
$report = @()
Write-Host "Searching for all vShield Edges..." -ForegroundColor Yellow
$edges = Get-View -ViewType virtualmachine -Property Name,Config -Filter @{'Config.VAppConfig.Product[0].Name'='vShield Edge'} | % {
$edge = '' | Select 'Name','Version'
$edge.Name = $_.Name
$edge.Version = $_.config.vappconfig.product[0].version
$report += $edge
}
$highestVersion = ($report | Sort version -Descending)[0].version
Write-Host "Highest vShield Edge version: $highestVersion" -ForegroundColor Yellow
Write-Host "Exporting upgradeable vShield Edges..." -ForegroundColor Yellow
$upgradableVSEs = $report | Where {$_.version -lt $highestVersion}
Write-Host "Saving file to: $reportPath" -ForegroundColor Yellow
$upgradableVSEs | Export-Csv -NoTypeInformation -UseCulture -Path $reportPath
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment