Commit 204b7d3
committed
Guard MSI UpgradeCode lookup against missing registry key
Get-ADTApplication built its MSI UpgradeCode lookup table with an
unguarded Get-ChildItem on
HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UpgradeCodes.
On machines where that key does not exist (e.g. images with no
MSI-registered upgrade codes), Get-ChildItem threw a PathNotFound
error that aborted the function's begin block, breaking any caller
such as Uninstall-ADTApplication.
Add -ErrorAction Ignore to match the pattern already used for the
uninstall key enumeration. When the key is absent the pipeline yields
no items, the scriptblock's begin/end blocks still run, and the
lookup table is simply empty; downstream indexing already returns
$null for GUIDs that are not present.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XLNM98Nd3HZLTWFatRVgB11 parent dff8573 commit 204b7d3
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
| 181 | + | |
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
| |||
0 commit comments