GeekAfterFive

Infrastructure as Code

home

vShield Edge Version Discovery with PowerCLI

22 May 2012

When upgrading vShield Manager, your vShield Edge devices will not be upgraded until you restart them. If you are in a situation where you need to do manual scheduled upgrades, this script will help you keep track of all the old versions running in your environment. Note: This is a vSphere PowerCLI script should work with both vCloud Director or regular vShield installs.
$report = @()
$VSEs = Get-View -ViewType virtualmachine -Filter @{"name"="vse"}

foreach ($vSE in $vSEs)
{

$vSEObject = New-Object PSObject
 Add-Member -MemberType NoteProperty -Name "Name" -Value $VSE.name -InputObject $vSEObject
 Add-Member -MemberType NoteProperty -Name "Version" -Value $VSE.config.vappconfig.product[0].version -InputObject $vSEObject
 Add-Member -MemberType NoteProperty -Name "Network0" -Value (Get-View -id $VSE.network[0].tostring()).name -InputObject $vSEObject
 Add-Member -MemberType NoteProperty -Name "Network1" -Value (Get-View -id $VSE.network[1].tostring()).name -InputObject $vSEObject

$report += $vSEObject
}

$highVer = ($report | Sort-Object -Property version -Descending)[0].version
$oldvSEs = $report | where {$_.version -ne $highVer}
$oldvSEs | Export-Csv $HOME\Desktop\oldvSEs.csv -NoTypeInformation
 
comments powered by Disqus