Files
PowerCLI-Example-Scripts/Scripts/ESXInstalledVIBs.ps1
dmilov fb641c8a1c License PowerCLI-Examples-Scripts repository under BSD-2 Clause (#462)
As part of the VMware open source program, we have to update this repository with the correct license and copyright information.
We add the BSD-2 Clause License for this repository.
We mark all source code provided by VMware with the Copyright notice under BSD-2 Clause license.

* Update repository license to BSD 2-Clause License

* Update Copyright
2021-06-07 09:58:47 +03:00

47 lines
1.3 KiB
PowerShell
Executable File

<#
Copyright 2021 VMware, Inc.
SPDX-License-Identifier: BSD-2-Clause
#>
<#
.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
}
}
}