VMware Cloud Community
umms
Enthusiast
Enthusiast

Script to perform 6.0u3 upgrade?

Hi, we have a bunch of hosts on 6.0u1. We are looking to do Cross vCenter Migration of the VMs to move them off and I noticed the requirement for this is 6.0u3. We have moved all the hosts under 6.7 vCenter and I can't upload the ISO to perform upgrade, so I am wondering if there is a PowerCli script to do it with the Offline upgrade bundle?? 

Thanks.

Reply
0 Kudos
3 Replies
LucD
Leadership
Leadership

You can't upload an ESXi image that has a lower version than your vCenter to the Update Manager.

You can try to patch the ESXi nodes, one by one, as standalone nodes.

I use a script like this for that.
Note that you will have to get the correct ZIP file.

$esxName = 'esx.my.domain'

$user = 'root'

$pswd = 'VMware1!'

$patchFile = 'ESXi670-201911001.zip'

$patchFolder = 'C:\Downloads'

$dsName = 'MyDatastore'

$dsFolder = 'Patches'


Connect-VIServer -Server $esxName -User $user -Password $pswd


$ds = Get-Datastore -Name $dsName

$patchPath = "$patchFolder\$patchFile"

$dsPath = "$($ds.DatastoreBrowserPath)\$dsFolder"


Copy-DatastoreItem -Item $patchPath -Destination $dsPath


$esxcli = Get-EsxCli -VMHost $esxName -V2

$sMaintOn = @{

    enable = $true

}

$esxcli.system.maintenanceMode.set.Invoke($sMaintOn)


$sPatch = @{

    depot = "/vmfs/volumes/$dsName/$dsFolder/$patchFile"

    maintenancemode = $true

#    dryrun = $true

}

$esxcli.software.vib.install.Invoke($sPatch)


$sReboot = @{

    reason = "Patch $patchFile applied"

}

$esxcli.system.shutdown.reboot.Invoke($sReboot)


# Wait for reboot to start

while(Test-Connection -ComputerName $esxName -Quiet -Count 1){

    sleep 2

}


# Wait till node is back

while(-not (Test-Connection -ComputerName $esxName -Quiet -Count 1)){

    sleep 2

}


Connect-VIServer -Server $esxName -User $user -Password $pswd

$esxcli = Get-EsxCli -VMHost $esxName -V2

if($esxcli.system.maintenanceMode.get.Invoke() -eq 'Enabled'){

    $sMaintOff = @{

        enable = $false

    }

    $esxcli.system.maintenanceMode.set.Invoke($sMaintOff)

}

Disconnect-VIServer -Server $esxName -Confirm:$false


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

Reply
0 Kudos
umms
Enthusiast
Enthusiast

I am guessing this should be "You can upload an ESXi image that has a lower version than your vCenter to the Update Manager." can = can't?

I will give this a try and report back.

Reply
0 Kudos
LucD
Leadership
Leadership

Correct, updated the text


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

Reply
0 Kudos