PowerCLI
PowerCLI last patch date script to get VIB install date
· ☕ 1 min read · ✍️ Javy de Koning
PowerCLI last patch date You might find yourself wanting a report of when your vSphere servers have been patched for the last time. Here you will find a simple PowerCLI script that uses vSphere CLI to query the last VIB install date. PowerCLI script: 1Get-VMHost | ForEach-Object -Process { 2 [PSCustomObject]@{ 3 'lastpatchdate' = [datetime]((Get-ESXCli -VMHost $_).software.vib.list() | 4 Select-Object -Property installdate -ExpandProperty installdate | 5 Sort-Object -Descending)[0] 6 'host' = $_.

PowerCLI one-liner to validate ESXi root passwords.
· ☕ 2 min read · ✍️ Javy de Koning
Below is a PowerCLI one-liner you can use to validate if all your root passwords are what you expect them to be. 1get-vmhost | %{ 2 $null = connect-viserver $_.name ` 3 -user root -password "MyFakePassword" -EA 0 4 5 if (-not ($?)) { 6 write-warning "Password failed for $($_.name)" 7 } else { 8 Disconnect-VIServer $_.name -force -confirm:$false 9 } 10} Reset a known password over PowerCLI Below is a short code snippet to help you change your root password on ESXi hosts.