- Context
I started recently to launch some feature updates of Windows 10 in a scheduled task running as ‘NT AUTHORIY\SYSTEM’ account. It also means that the UI is hidden for whoever is logged on the computer.
I was also looking for some additional info about:
– how to detect that a feature is running
– how to detect that a feature has just finished running
– how to detect that a reboot is pending because of the feature update that just ran
- Solution
I started investigating using procmon.exe and tracked what’s written under HKLM\System\setup.
I noticed that I can track the progress of a feature update by using a one-liner:
While (ps setup* ) { Write-Progress -Activity Upgrade -PercentComplete "$((gp HKLM:\SYSTEM\Setup\MoSetup\Volatile -Name SetupProgress).SetupProgress)" -Status "at $((gp HKLM:\SYSTEM\Setup\MoSetup\Volatile -Name SetupProgress).SetupProgress)%" }
It appears that a SetupProgress value is written under the registry key HKLM:\SYSTEM\Setup\MoSetup\Volatile
Here’s a more readable splatted version of the one-liner:
While (Get-Process -Name setup*) { $k = 'HKLM:\SYSTEM\Setup\MoSetup\Volatile' $n = 'SetupProgress' $p = Get-ItemProperty -Path $k -Name $n $HT = @{ Activity = 'Upgrade' PercentComplete = "$($($p).$n)" Status = "at $($($p).$n)%" } Write-Progress @HT }
It’s documented on https://docs.microsoft.com/en-us/windows/deployment/upgrade/troubleshoot-upgrade-errors
Pingback: Dew Drop – September 8, 2020 (#3270) | Morning Dew