The version mismatch problem
The standard MSI uninstall command requires the exact MSI file that was used to install Grunt:ProductCode changes and the uninstall command for the old version no longer matches. The result is a silent failure — the uninstall exits without removing anything.
Version-independent uninstall using UpgradeCode
The reliable approach is to look up the currently installed Grunt package by itsUpgradeCode and uninstall the matching ProductCode. The UpgradeCode stays the same across all Grunt versions, so this method works regardless of which version the user is running.
Grunt UpgradeCode
| Architecture | UpgradeCode |
|---|---|
| x64 | {E98C1BF9-9AF8-47CF-940B-14F8937CED83} |
PowerShell script
The following script finds and uninstalls the installed Grunt package using the Windows Installer COM object:- Queries the Windows Installer database for any product registered under the Grunt
UpgradeCode - Retrieves the
ProductCodeof the installed version - Runs
msiexec /xagainst thatProductCodeto perform a silent uninstall
Because Grunt uses a per-user installation model by default, this script must run in the user context. If you are using PSADT, use
Execute-ProcessAsUser (v3) or Start-ADTMsiProcessAsUser (v4) to run the uninstall as the logged-in user.PSADT v3 example
Why not uninstall by MSI file
Uninstalling withmsiexec /x <file>.msi ties the uninstall to a specific Grunt version. If the user has updated Grunt since the original deployment, the MSI file no longer matches the installed product and the uninstall silently fails. The UpgradeCode approach avoids this by dynamically resolving the correct ProductCode at uninstall time.