Hi all,
I recently (last weekend) upgraded my virtual center servers from 6.0 U3 to 6.7 U1 and have now discovered the vum instance will no longer patch / update any esx hosts that are not version 6.7 (which is my entire environment of 300 plus hosts). So I was trying to write quick powercli script to accomplish this task. I am trying to use install-vmhostpatch -webpath parameter to avoid having to copy the patch file locally to every host. But it is not working for me as of yet. I keep getting "Failed to download metadata" I'm sure I'm missing something obvious in my simple script. Once I get the functionality working I'll add more refinements to the script (like error checking etc.).
What credentials does it use to connect via http to the source server?
Does it matter that the source web server is a Linux server?
Can you use the [-HostUsername <String>] [-HostPassword <SecureString>] [-HostCredential <PSCredential>] options with the -WebPath option?
Script and output are:
$tobpatched = Read-Host "Please enter the name of the ESXi 6.0 host you want to patch "
$esxcreds = Get-Credential -Message "Enter the root credentials for $tobpatched "
#connect to the esx host
Connect-VIServer -Server $tobpatched -Credential $esxcreds -ErrorAction Stop
#check to see if the host is in maintenance mode.
$connstate = Get-vmhost |Select-Object ConnectionState
if ($connstate.ConnectionState -ne "Maintenance") {Set-vmhost -VMHost $tobpatched -State Maintenance}
#install patches
Write-Host "Starting to install the patches" -ForegroundColor Cyan
Install-VMHostPatch -WebPath http://servername/path/topatches/ESXi600-201811001/metadata.zip -Verbose
Output:
Please enter the name of the ESXi 6.0 host you want to patch : vsdc-01-ah
Windows PowerShell credential request.
Enter the root credentials for vsdc-01-ah
User: root
Password for user root: ********
Name Port User
---- ---- ----
vsdc-01-ah 443 root
Starting to install the patches
VERBOSE: Perform operation 'Installing patch.' on VM host 'vsdc-01-ah'.
VERBOSE: 12/13/2018 2:08:18 PM Install-VMHostPatch Finished execution
WARNING: Failed to download metadata.