Adding several vSphere 6.5 API examples
This commit is contained in:
41
Scripts/ESXInstalledVIBs.ps1
Executable file
41
Scripts/ESXInstalledVIBs.ps1
Executable file
@@ -0,0 +1,41 @@
|
||||
<#
|
||||
.SYNOPSIS Retrieve the installation date of an ESXi host
|
||||
.NOTES Author: William Lam
|
||||
.NOTES Site: www.virtuallyghetto.com
|
||||
.PARAMETER Vmhost
|
||||
ESXi host to query installed ESXi VIBs
|
||||
.EXAMPLE
|
||||
Get-ESXInstalledVibs -Vmhost (Get-Vmhost "mini")
|
||||
.EXAMPLE
|
||||
Get-ESXInstalledVibs -Vmhost (Get-Vmhost "mini") -vibname vsan
|
||||
#>
|
||||
|
||||
Function Get-ESXInstalledVibs {
|
||||
param(
|
||||
[Parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true)
|
||||
]
|
||||
[VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl]$Vmhost,
|
||||
[Parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true)
|
||||
]
|
||||
[String]$vibname=""
|
||||
)
|
||||
|
||||
$imageManager = Get-View ($Vmhost.ExtensionData.ConfigManager.ImageConfigManager)
|
||||
$vibs = $imageManager.fetchSoftwarePackages()
|
||||
|
||||
foreach ($vib in $vibs) {
|
||||
if($vibname -ne "") {
|
||||
if($vib.name -eq $vibname) {
|
||||
return $vib | select Name, Version, Vendor, CreationDate, Summary
|
||||
}
|
||||
} else {
|
||||
$vib | select Name, Version, Vendor, CreationDate, Summary
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user