MSI installer does not refresh registry InstallDate on version upgrade - #30093
Open
Aditya Pujara (a0x1ab) with Copilot wants to merge 2 commits into
Open
MSI installer does not refresh registry InstallDate on version upgrade#30093Aditya Pujara (a0x1ab) with Copilot wants to merge 2 commits into
Aditya Pujara (a0x1ab) with Copilot wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
|
Azure Pipelines: Successfully started running 2 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
Contributor
|
Azure Pipelines: Successfully started running 2 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
Copilot
AI
changed the title
[WIP] Fix incorrect installed date for Az PS MSI version
MSI installer does not refresh registry InstallDate on version upgrade
Sep 1, 2026
| <Custom Action='RefreshInstallDate' After='RegisterProduct'>NOT REMOVE</Custom> | ||
| </InstallExecuteSequence> | ||
|
|
||
| <CustomAction Id='RefreshInstallDate' Execute='deferred' Property="POWERSHELLEXE" ExeCommand="-noprofile -nologo -noninteractive -executionpolicy bypass -command "Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\[ProductCode]' -Name 'InstallDate' -Value (Get-Date -Format 'yyyyMMdd') -Type String -Force"" Impersonate="no" Return='ignore'/> |
Live test skipped⏭️ Skipping the live test for this revision because no changed test file was found under a The live-test pipeline runs only the scenario/xUnit test files a PR changes, so there is nothing to execute for this commit. This is informational — a regression test is encouraged where it makes sense, but not required. If a test file is added in a later commit, the live test will run automatically. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 PR Validation — ️✔️ All clear
After upgrading the Az PowerShell MSI (e.g. via Intune), Programs and Features shows the new
DisplayVersionbut a stale "Installed On" date. The reporter's ARP key confirms it:The MSI relies solely on the standard
RegisterProductaction to publish ARP data. When the engine registers over an existing product registration (reinstall / same-product-code upgrade paths, which is what Intune's mandatory-app deployment ends up doing), it refreshesDisplayVersionbut leaves the recordedInstallDateuntouched.Changes (
setup/azurecmd.wxs)RefreshInstallDatecustom action — rewritesHKLM\...\Uninstall\[ProductCode]\InstallDatewith the current date in theyyyyMMddform the shell expects, so the value always reflects the actual install/upgrade regardless of which upgrade path Windows Installer takes.After='RegisterProduct'(inside theInstallInitialize/InstallFinalizewindow) so it overwrites whatever the engine published; conditionedNOT REMOVEso uninstall is unaffected.Execute='deferred' Impersonate='no'for the elevated HKLM write, andReturn='ignore'so this can never fail an installation.POWERSHELLEXEtype-50 custom action style as the neighbouringExecutionPolicyaction. Invokingsystem32\powershell.exealso keeps WOW64 redirection consistent per package: the x86 package's 32-bit custom action lands on theWow6432NodeARP key, which is where its entry lives.Note for reviewers
[ProductCode]inExeCommandis fine for a deferred action: the "onlyCustomActionDatais available" rule applies to properties read from the session by DLL/script custom actions. For type-50 EXE actions theTargetfield is a Formatted field resolved when the action is written to the execution script during the immediate phase — the same mechanism the pre-existing deferredExecutionPolicyaction already relies on forPOWERSHELLEXE.ProductCodeis additionally one of the few properties available even at deferred execution time.The MSI can't be built or installed in this environment (needs WiX + Windows); verification here was limited to the
.wxsauthoring and the embedded PowerShell command. Worth a manual upgrade check against a machine with a prior release installed.