Browse Source

Improved UninstallPCHealthCheck function for Windows 10

master
Dmitry Nefedov 3 months ago
parent
commit
2331c1b26e
  1. 4
      src/Sophia_Script_for_Windows_10/Module/Sophia.psm1
  2. 4
      src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1

4
src/Sophia_Script_for_Windows_10/Module/Sophia.psm1

@ -10219,6 +10219,9 @@ function UninstallPCHealthCheck
foreach ($MSI in @(Get-ChildItem -Path "$env:SystemRoot\Installer" -Filter *.msi -File -Force))
{
$Name = $Files.Keys | Where-Object -FilterScript {$_ -eq $MSI.Name}
# Check if necessary files exist in folder unless we get a bunch of errors for $File variable
if ($Name)
{
$File = $Files[$Name]
# https://learn.microsoft.com/en-us/previous-versions/tn-archive/ee176615(v=technet.10)
@ -10229,6 +10232,7 @@ function UninstallPCHealthCheck
break
}
}
}
# Prevent the "PC Health Check" app from installing in the future
if (-not (Test-Path -Path HKLM:\SOFTWARE\Microsoft\PCHC))

4
src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1

@ -10225,6 +10225,9 @@ function UninstallPCHealthCheck
foreach ($MSI in @(Get-ChildItem -Path "$env:SystemRoot\Installer" -Filter *.msi -File -Force))
{
$Name = $Files.Keys | Where-Object -FilterScript {$_ -eq $MSI.Name}
# Check if necessary files exist in folder unless we get a bunch of errors for $File variable
if ($Name)
{
$File = $Files[$Name]
# https://learn.microsoft.com/en-us/previous-versions/tn-archive/ee176615(v=technet.10)
@ -10235,6 +10238,7 @@ function UninstallPCHealthCheck
break
}
}
}
# Prevent the "PC Health Check" app from installing in the future
if (-not (Test-Path -Path HKLM:\SOFTWARE\Microsoft\PCHC))

Loading…
Cancel
Save