From 7498674bed46c8ab547d34bf6fb941d791b8efbf Mon Sep 17 00:00:00 2001 From: Jacob Stamm Date: Wed, 11 Dec 2024 17:13:06 -0500 Subject: [PATCH] Update how-to-determine-which-versions-are-installed.md Make script to detect old .NET Framework versions compatible with PowerShell 2 --- .../how-to-determine-which-versions-are-installed.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/framework/migration-guide/how-to-determine-which-versions-are-installed.md b/docs/framework/migration-guide/how-to-determine-which-versions-are-installed.md index 65d2cb39f2a11..f15ac2e66a40c 100644 --- a/docs/framework/migration-guide/how-to-determine-which-versions-are-installed.md +++ b/docs/framework/migration-guide/how-to-determine-which-versions-are-installed.md @@ -266,9 +266,9 @@ ForEach-Object { $parentName = $_.PSChildName Get-ChildItem -LiteralPath $_.PSPath | Where-Object { - if ($_.Property -contains 'Version') { $name = Get-ItemPropertyValue -Path $_.PSPath -Name Version } - if ($name -and ($_.Property -contains 'SP')) { $sp = Get-ItemPropertyValue -Path $_.PSPath -Name SP } - if ($_.Property -contains 'Install') { $install = Get-ItemPropertyValue -Path $_.PSPath -Name Install } + if ($_.Property -contains 'Version') { $name = $((Get-ItemProperty -Path "Registry::$_").Version) } + if ($name -and ($_.Property -contains 'SP')) { $sp = $((Get-ItemProperty -Path "Registry::$_").SP) } + if ($_.Property -contains 'Install') { $install = $((Get-ItemProperty -Path "Registry::$_").Install) } if (-not $install) { Write-Host -Object " $($parentName) $($name)" }