From 8948d2929c64f9a4b599aa8eb69ca50b93407c63 Mon Sep 17 00:00:00 2001 From: Dmitry Nefedov Date: Tue, 13 May 2025 23:26:30 +0300 Subject: [PATCH] Improved UninstallPCHealthCheck function --- src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 | 2 +- .../Module/Sophia.psm1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 index 83986a6c..504a28cc 100644 --- a/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 @@ -9900,7 +9900,7 @@ function UninstallPCHealthCheck # Find the necessary .msi with the Subject property equal to "Windows PC Health Check" foreach ($MSI in @(Get-ChildItem -Path "$env:SystemRoot\Installer" -Filter *.msi -File -Force)) { - $Name = $Files.Keys | Where-Object -FilterScript {$_ -eq $MSI.BaseName} + $Name = $Files.Keys | Where-Object -FilterScript {($_ -eq $MSI.BaseName) -or ($_ -eq $MSI.Name)} # Checking whether necessary files exist in folder unless we get a bunch of errors for $File variable if ($Name) { diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 index dd014162..58097682 100644 --- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 @@ -9934,7 +9934,7 @@ function UninstallPCHealthCheck # Find the necessary .msi with the Subject property equal to "Windows PC Health Check" foreach ($MSI in @(Get-ChildItem -Path "$env:SystemRoot\Installer" -Filter *.msi -File -Force)) { - $Name = $Files.Keys | Where-Object -FilterScript {$_ -eq $MSI.BaseName} + $Name = $Files.Keys | Where-Object -FilterScript {($_ -eq $MSI.BaseName) -or ($_ -eq $MSI.Name)} # Checking whether necessary files exist in folder unless we get a bunch of errors for $File variable if ($Name) {