kms-website: fix Office auto-key label filter ($_ shadowing in switch)
Inside `switch ($label) {...}` the automatic $_ is the switch input (the label),
not the Where-Object pipeline item, so the per-product filter always matched and
KMS_AUTO=office would also install Project/Visio keys. Replace with explicit
label/$_ comparisons.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
9059dbc85b
commit
f1440dfcf4
1 changed files with 5 additions and 1 deletions
|
|
@ -174,8 +174,12 @@ function Activate-Ospp([string]$label) {
|
|||
if ($st -match '---LICENSED---') { OK "$label already licensed - host set, skipping /act"; return }
|
||||
# Not licensed: install the matching GVLK for each installed VL product of
|
||||
# this family (Office = anything that isn't Project/Visio), fetched from the list.
|
||||
# Match this family's installed VL products. NB: avoid `switch ($label)` here —
|
||||
# inside a switch, $_ is the switch input (the label), not the pipeline item.
|
||||
$rels = Get-OfficeReleaseIds | Where-Object {
|
||||
switch ($label) { 'Project' { $_ -match 'Project' } 'Visio' { $_ -match 'Visio' } default { $_ -notmatch 'Project|Visio' } }
|
||||
($label -eq 'Project' -and $_ -match 'Project') -or
|
||||
($label -eq 'Visio' -and $_ -match 'Visio') -or
|
||||
($label -eq 'Office' -and $_ -notmatch 'Project|Visio')
|
||||
}
|
||||
$keys = Get-Keys
|
||||
foreach ($rel in $rels) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue