-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Labels
enhancementAn enhancement to the package functionality.An enhancement to the package functionality.
Description
See this Disqus comment:
There is a bug in # loop over each found installation and ignore it if it matches a value in '/IgnoreInstalled' that multiplies the found installs by the number of not matching IgnoreInstalled, e.g 8 matching installs instead of 2 (and will also prevent reaching 1 matchig installs after processing other configurations). I defects the result for all multiple IgnoreInstalled.
/IgnoreInstalled package parameter was passed with these software names:
- Adobe Acrobat X Pro*
- Adobe Acrobat XI Pro
- Adobe Acrobat DC (2015)
- Adobe Acrobat 2017
Keeping 'Adobe Acrobat 2020' as it does not match 'Adobe Acrobat X Pro*)'
Keeping 'Adobe Acrobat 2020' as it does not match 'Adobe Acrobat XI Pro)'
Keeping 'Adobe Acrobat 2020' as it does not match 'Adobe Acrobat DC (2015))'
Keeping 'Adobe Acrobat 2020' as it does not match 'Adobe Acrobat 2017)'
Keeping 'Adobe Acrobat (64-bit)' as it does not match 'Adobe Acrobat X Pro*)'
Keeping 'Adobe Acrobat (64-bit)' as it does not match 'Adobe Acrobat XI Pro)'
Keeping 'Adobe Acrobat (64-bit)' as it does not match 'Adobe Acrobat DC (2015))'
Keeping 'Adobe Acrobat (64-bit)' as it does not match 'Adobe Acrobat 2017)'
After processing, we will use this list of installed software:
- Adobe Acrobat 2020
- Adobe Acrobat 2020
- Adobe Acrobat 2020
- Adobe Acrobat 2020
- Adobe Acrobat (64-bit)
- Adobe Acrobat (64-bit)
- Adobe Acrobat (64-bit)
- Adobe Acrobat (64-bit)
8 matching installs of Adobe Acrobat Reader DC found!
To prevent accidental data loss, this install will be aborted.
Maybe modify the code to something like the following?
# loop over each found installation and ignore it if it matches a value in '/IgnoreInstalled'
$key = for ($i = 0; $i -lt $installation.count; $i++) {
$KEEP = $true
for ($j = 0; $j -lt $matchInstallation.count; $j++) {
if ($installation[$i].DisplayName -notlike $matchInstallation[$j]) {
Write-Verbose "Keeping '$($installation[$i].DisplayName)' as it does not match '$($matchInstallation[$j]))'"
}
else {
$KEEP = $false
Write-Verbose "Removing '$($installation[$i].DisplayName)' from list of found software, as it matches '$($matchInstallation[$j]))'"
}
}
If ($KEEP) {
$installation[$i]
}
}
Metadata
Metadata
Assignees
Labels
enhancementAn enhancement to the package functionality.An enhancement to the package functionality.