Browse Source

Improved UninstallPCHealthCheck function for Windows 10

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

18
src/Sophia_Script_for_Windows_10/Module/Sophia.psm1

@ -10219,14 +10219,18 @@ function UninstallPCHealthCheck
foreach ($MSI in @(Get-ChildItem -Path "$env:SystemRoot\Installer" -Filter *.msi -File -Force))
{
$Name = $Files.Keys | Where-Object -FilterScript {$_ -eq $MSI.Name}
$File = $Files[$Name]
# https://learn.microsoft.com/en-us/previous-versions/tn-archive/ee176615(v=technet.10)
# "22" is the "Subject" file property
if ($Folder.GetDetailsOf($File, 22) -eq "Windows PC Health Check")
# Check if necessary files exist in folder unless we get a bunch of errors for $File variable
if ($Name)
{
Start-Process -FilePath msiexec.exe -ArgumentList "/uninstall $($MSI.FullName) /quiet /norestart" -Wait
break
$File = $Files[$Name]
# https://learn.microsoft.com/en-us/previous-versions/tn-archive/ee176615(v=technet.10)
# "22" is the "Subject" file property
if ($Folder.GetDetailsOf($File, 22) -eq "Windows PC Health Check")
{
Start-Process -FilePath msiexec.exe -ArgumentList "/uninstall $($MSI.FullName) /quiet /norestart" -Wait
break
}
}
}

18
src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1

@ -10225,14 +10225,18 @@ function UninstallPCHealthCheck
foreach ($MSI in @(Get-ChildItem -Path "$env:SystemRoot\Installer" -Filter *.msi -File -Force))
{
$Name = $Files.Keys | Where-Object -FilterScript {$_ -eq $MSI.Name}
$File = $Files[$Name]
# https://learn.microsoft.com/en-us/previous-versions/tn-archive/ee176615(v=technet.10)
# "22" is the "Subject" file property
if ($Folder.GetDetailsOf($File, 22) -eq "Windows PC Health Check")
# Check if necessary files exist in folder unless we get a bunch of errors for $File variable
if ($Name)
{
Start-Process -FilePath msiexec.exe -ArgumentList "/uninstall $($MSI.FullName) /quiet /norestart" -Wait
break
$File = $Files[$Name]
# https://learn.microsoft.com/en-us/previous-versions/tn-archive/ee176615(v=technet.10)
# "22" is the "Subject" file property
if ($Folder.GetDetailsOf($File, 22) -eq "Windows PC Health Check")
{
Start-Process -FilePath msiexec.exe -ArgumentList "/uninstall $($MSI.FullName) /quiet /norestart" -Wait
break
}
}
}

Loading…
Cancel
Save