VMware Cloud Community
tdubb123
Expert
Expert

upgrading from 6.5 to 6.7 and patching with latest updates

I am trying to upgrade a host from 6.5 to 6.7 asnd then applying all ciritical and non critical updates. I think I will need 2 separate tasks for this?

import-module Vmware.VimAutomation.Core

import-module Vmware.Vumautomation

$vmhost = read-host "enter hostname that needs to be patched"

write-host ""

if ($vmhost.ConnectionState -eq "connected") {

Set-VMHost -VMHost $vmhost -State Maintenance -Confirm:$false

}

Get-Baseline -Name "Cisco C240S ESXi 6.7U1 upgrade" | Attach-Baseline -entity $vmhost -Confirm:$false

Scan-Inventory -Entity $vmhost

get-baseline -name "Cisco C240S ESXi 6.7U1 upgrade" | Remediate-Inventory -Entity $vmhost -Confirm:$false -ErrorAction SilentlyContinue

start-sleep -s 300

if ($vmhost.ConnectionState -eq "connected") {

Set-VMHost -VMHost $vmhost -State Maintenance -Confirm:$false

}

Get-Baseline -Name *Critical* | Attach-Baseline -entity $vmhost -Confirm:$false

Scan-Inventory -Entity $vmhost

get-baseline -name *Critical* | Remediate-Inventory -Entity $vmhost -Confirm:$false -ErrorAction SilentlyContinue

the script seems to be stuck after the host is upgraded. but does not proceed to getting the latest patches/updates. Also after the host comes back online after upgrade it takes it out of maintenance mode immediately. why is that?

Reply
0 Kudos
1 Reply
LucD
Leadership
Leadership

Where is it stuck exactly?

Before you place it back in maintenance mode? Or before you attach the baseline for the patches?

Is the /tmp/scratch folder (or whichever location you defined for the scratch folder) still as it was before the upgrade?
If not, that would explain the ESXi node not being maintenance mode after the upgrade.

I experienced similar when upgrading from 6.5 to 6.7.

PS: have you considered using the esxcli command (via Get-EsxCli) to do the upgrade?

When I used that one I didn't experience the maintenance mode issue.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos