Jan 30 2023 02:24 AM
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 machines so makes sense to use that. My issue is that I can write a powershell script to check that dword exists for that version in this case 6.0.13 but I want to check for version 6.0.7 and anything greater than that number but in the DWORD name rather than it's value... any ideas welcome! 🙂 Thanks
$DWordName = "6.0.13"
$Locations =
"HKLM:\SOFTWARE\WOW6432Node\dotnet\Setup\InstalledVersions\x64\sharedfx\Microsoft.WindowsDesktop.App"
foreach($location in $locations)
{
if((get-itempropertyvalue -path $location -name $DWordName) -eq "1"){write-host "Value already exists"}
write-output "installed" }
Jan 30 2023 12:07 PM
@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))
}
}
Jan 31 2023 03:07 AM
@Harm_Veenstra Thanks 🙂 - I will give it a go and let you know 🙂
Feb 09 2023 06:28 AM