Typically customers opt to place browsers and Adobe Reader in their VDI images due to the majority of their users utilizing them. Sometimes it is an extra half hour of work just to get them updated and often a step gets missed along the way. Just as you push the image to production, you realize you forgot to disable the scheduled update task, or you forgot to disable the update services.

I came up with a PowerShell script that helps expedite these tasks to hopefully slim it down to just a few minutes of maintenance time. Here’s a quick overview of the sequence:

  1. Upon executing the script (run it as an admin!), it will set all the update services to manual and tells you to proceed with updates and hit Enter once all components are updated: Chrome, Firefox, Chromium Edge, and Adobe.
  2. Once you hit enter, the script checks for any Active Setup StubPaths that got added back in due to the updates. That’s the little grey box at the top-left during login that can chew up extra CPU during the login process.
  3. The script then checks for any scheduled tasks at the root folder-level that contain the word “update” and disables them. Here’s what the entire thing looks like when you run it:

Here is the script – copy to a .ps1 and enjoy!

# Use this script to temporarily set services back to manual for Chrome, Firefox, Edge, and Adobe updates.
# Follow the prompts. Script will automatically re-disable and perform cleanup after updates are completed.
# Written by Nick Burton

#### Variables ####
# Services
$AdobeUpdate = "AdobeARMService"
$EdgeUpdate = "EdgeUpdate"
$EdgeUpdateM = "EdgeUpdateM"
$GoogleUpdate = "gupdate"
$GoogleUpdateM = "gupdatem"
$MozillaUpdate = "MozillaMaintenance"
# Active Setup GUIDs
$ChromeActiveSetupGUID = "{8A69D345-D564-463c-AFF1-A69D9E530F96}"
$EdgeActiveSetupGUID = "{9459C573-B17A-45AE-9F64-1857B5D58CEE}"
#### End Variables ####

Write-Host -ForegroundColor Green "Setting services to manual..."

Set-Service -Name $AdobeUpdate -StartupType Manual
Set-Service -Name $EdgeUpdate -StartupType Manual
Set-Service -Name $EdgeUpdateM -StartupType Manual
Set-Service -Name $GoogleUpdate -StartupType Manual
Set-Service -Name $GoogleUpdateM -StartupType Manual
Set-Service -Name $MozillaUpdate -StartupType Manual

Write-Host -ForegroundColor Green "Services set to manual! Please perform necessary updates now!"
Read-Host "Press enter after performing updates..."

# Now it's time to cleanup StubPaths and tasks...
# First Chrome...
Write-Host -ForegroundColor Green "Checking for StubPaths in Active Setup and removing..."
Try
{
Remove-ItemProperty -Path "HKLM:\Software\Microsoft\Active Setup\Installed Components\$ChromeActiveSetupGUID" -Name "StubPath" -ErrorAction Stop
Write-Host -ForegroundColor Green "Found and removed StubPath for Chrome!"
}
Catch
{
Write-Host -foregroundcolor Green "No StubPath found for Chrome under $ChromeActiveSetupGUID"
}
# Now Edge...
Try
{
Remove-ItemProperty -Path "HKLM:\Software\Microsoft\Active Setup\Installed Components\$EdgeActiveSetupGUID" -Name "StubPath" -ErrorAction Stop
Write-Host -ForegroundColor Green "Found and removed StubPath for Edge!"
}
Catch
{
Write-Host -foregroundcolor Green "No StubPath found for Edge under $EdgeActiveSetupGUID"
}

Write-Host -ForegroundColor Green "Disabling all root-level tasks that contain the word update..."

Get-ScheduledTask "*update*" -TaskPath \ | Disable-ScheduledTask

Write-Host -ForegroundColor Green "Setting all update services back to disabled..."

Set-Service -Name $AdobeUpdate -StartupType Disabled
Set-Service -Name $EdgeUpdate -StartupType Disabled
Set-Service -Name $EdgeUpdateM -StartupType Disabled
Set-Service -Name $GoogleUpdate -StartupType Disabled
Set-Service -Name $GoogleUpdateM -StartupType Disabled
Set-Service -Name $MozillaUpdate -StartupType Disabled

Write-Host -ForegroundColor Green "Script completed!"