Skip to content

Fix error in powershell script in authority-information-access-retrieval.md - #8146

Open
dodexahedron (dodexahedron) wants to merge 1 commit into
MicrosoftDocs:mainfrom
dodexahedron:patch-3
Open

Fix error in powershell script in authority-information-access-retrieval.md#8146
dodexahedron (dodexahedron) wants to merge 1 commit into
MicrosoftDocs:mainfrom
dodexahedron:patch-3

Conversation

@dodexahedron

@dodexahedron dodexahedron (dodexahedron) commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

The powershell snippet in this document used the wrong variable name in the switch statement ($value), making it never work propertly. Fixed by changing it to $regCheck.

Borked version has incorrect output because, in a clean session, $value is just $null, hitting the default case, but outputs "0" to the console, which is further confusing. If $value happens to already exist from earlier in the session, any one of the three cases of the switch statement or an exception are possible, depending on what it is, which is obviously also goodn't.

…val.md

The powershell snippet in this document used the wrong variable name in the switch statement (`$value`), making it never work propertly. Fixed by changing it to `$regCheck`.
@prmerger-automator

Copy link
Copy Markdown
Contributor

dodexahedron (@dodexahedron) : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change.

1 similar comment
@prmerger-automator

Copy link
Copy Markdown
Contributor

dodexahedron (@dodexahedron) : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change.

@learn-build-service-prod

Copy link
Copy Markdown
Contributor

Learn Build status updates of commit 33715e3:

✅ Validation status: passed

File Status Preview URL Details
WindowsServerDocs/security/authority-information-access-retrieval.md ✅Succeeded

For more details, please refer to the build report.

@dodexahedron

Copy link
Copy Markdown
Contributor Author

Broken version was

$registryPath = "HKLM:\Software\Policies\Microsoft\SystemCertificates\ChainEngine\Config"
$propertyName = "Options"
 
try {
    $regCheck = (Get-ItemProperty -Path $registryPath -Name $propertyName -ErrorAction Stop).$propertyName
 
    switch ($value) {
        0 { "AIA is Enabled" }
        2 { "AIA is Disabled" }
        default { "Unexpected value: $regCheck" }
    }
} catch {
    "AIA has not been set"
}

Fixed version only changes the condition of the switch:

$registryPath = "HKLM:\Software\Policies\Microsoft\SystemCertificates\ChainEngine\Config"
$propertyName = "Options"
 
try {
    $regCheck = (Get-ItemProperty -Path $registryPath -Name $propertyName -ErrorAction Stop).$propertyName
 
    switch ($regCheck) {
        0 { "AIA is Enabled" }
        2 { "AIA is Disabled" }
        default { "Unexpected value: $regCheck" }
    }
} catch {
    "AIA has not been set"
}

@dodexahedron

Copy link
Copy Markdown
Contributor Author

CLA previously signed. Ready to go at your leisure.

@dodexahedron

Copy link
Copy Markdown
Contributor Author

Actually, looks like someone submitted this fix 4 months ago, already, in #8132.

Feel free to close this as a duplicate, but I'm leaving it up here for visibility since there seems to have been no motion on #8132.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants