Forum Discussion
yoyojammer
Jan 30, 2023Copper Contributor
How can I check a DWORD name and use Greater Than command?
Hi all, not being a powershell expert but need help... Pushing out Desktop Runtime but finding a detection method is tricky, however a DWORD name is shown for that version in the same place in all ma...
Jan 30, 2023
yoyojammer I think this should work. In my case, it outputs this:
WARNING: Found old version 5.0.17 of Microsoft.WindowsDesktop.App which is not greater or equal to 6.0.13
Found version 6.0.13 of Microsoft.WindowsDesktop.App which is greater or equal to 6.0.13
Found version 7.0.2 of Microsoft.WindowsDesktop.App which is greater or equal to 6.0.13
Code:
$DWordName = "6.0.13"
$Location = "HKLM:\SOFTWARE\WOW6432Node\dotnet\Setup\InstalledVersions\x64\sharedfx\"
$filter = 'Microsoft.WindowsDesktop.App'
foreach ($version in (Get-ChildItem -Path $location | Where-Object Name -match $filter).Property | Sort-Object) {
if ($version -ge $DWordName) {
Write-Host ("Found version {0} of {1} which is greater or equal to {2}" -f $version, $filter, $DWordName) -ForegroundColor Green
}
else {
Write-Warning (("Found old version {0} of {1} which is not greater or equal to {2}" -f $version, $filter, $DWordName))
}
}
- yoyojammerJan 31, 2023Copper Contributor
Harm_Veenstra Thanks 🙂 - I will give it a go and let you know 🙂
- Feb 23, 2023Any update?