By default, vCenter Server will automatically check and download the latest ESXi updates that can then be used by either the deprecated vSphere Update Manager (VUM) or its replacement which is vSphere Lifecycle Manager (vLCM), both of which can be managed under the Lifecycle Manager section in the vSphere UI.
Interestingly, I have had a number of inquiries about disabling the automatic download setting using automation, as I assume users have setup Update Manager Depot Service (UMDS) instance for consolidated and/or offline access.
Disabling the automatic download in the vSphere UI is very straight forward by going to Lifecycle Manager->Settings->Administration->Patch Downloads and clicking on the Edit button to enable or disable the setting.
Because the Lifecycle Manager section combines functionality for both VUM and vLCM, it can sometimes be confusing on which vSphere API to use and this is important becauase VUM does not have any public API and only subset of its functionality can be automated using specific VUM PowerCLI cmdlets. This is another benefit to using vLCM, not only is it the replacement for VUM going forward, but all of its functionality is available using both the vSphere UI or vSphere REST API.
With that said, the automatic download setting is actually a VUM-based configuration and as mentioned earlier, there are no public APIs for managing these settings. However, I recently found a clever workaround that would allow users to automate disabling this setting.
If you look closely at the text next to the setting, you will see a reference to this automatic download being implemented as vCenter Scheduled Task, which can confirm by navigating to the vCenter Server inventory object and going to Configure->Scheduled Tasks
Since the vCenter Scheduled Tasks functionality does have vSphere API, I was wondering if we simply removed the scheduled task, would it automatically disable the Lifecycle Manager download setting? 🤔
Long story short, the answer is yes! After manually verifying the behavior using the vSphere UI, I knew that we could now automate this using the vSphere API!
The following PowerCLI snippet demonstrates the use of scheduled tasks vSphere API to delete an existing schedule task with the following label "VMware vSphere Lifecycle Manager Update Download":
$scheduleTaskMgr = Get-View $global:DefaultVIServer.ExtensionData.Content.ScheduledTaskManager $scheduleTasks = $scheduleTaskMgr.RetrieveEntityScheduledTask((Get-Folder -Name Datacenters).ExtensionData.MoRef) foreach ($scheduleTask in $scheduleTasks) { $scheduleTaskRef = Get-View $scheduleTask if($scheduleTaskRef.Info.Name -eq "VMware vSphere Lifecycle Manager Update Download") { Write-host -ForegroundColor Cyan "`nDeleting vLCM Automatic Download Scheduled Task ...`n" $scheduleTaskRef.RemoveScheduledTask() break } }
Here is an example screenshot of running the following snippet above:
If we navigate back to the vCenter Lifecycle Manager settings, we now see that the automatic download is disabled!
Per N says
Thanks for this article. Saved me time on auto deployed systems. However, to go even further is it possible to disable the four pre-configured Download Sources with PowerCLI too?
Thanks in advance,
Per