Uninstall PDF-XChange Editor:
$programName = "*PDF-XChange Editor*"
$installedProducts = Get-WmiObject Win32_Product
$filteredProducts = $installedProducts | Where-Object { $_.Name -like $programName }
if ($filteredProducts.Count -eq 0) {
Write-Host "No products found matching the name $programName."
} else {
foreach ($product in $filteredProducts) {
$identifyingNumber = $product.IdentifyingNumber
Write-Host "Uninstalling $($product.Name) with IdentifyingNumber $identifyingNumber"
Start-Process "msiexec.exe" -ArgumentList "/qn /norestart /X $identifyingNumber" -Wait
}
Write-Host "All products matching the name $programName have been uninstalled."
}
Reinstall PDF-XChange Editor:
$ProgressPreference = "SilentlyContinue"
$Path = "C:\Users\Public\Downloads"
$Downloads = @(
@{
Name = "PDF-XChange Editor"
Link = "https://downloads.pdf-xchange.com/EditorV10.x64.msi"
File = "EditorV10.x64.msi"
InstallArgs = "/i `"$Path\EditorV10.x64.msi`" /qn /L*v `"$Path\pdf-x-install.log`""
},
@{
Name = "Visual C++ Redistributable x86"
Link = "https://aka.ms/vs/17/release/vc_redist.x86.exe"
File = "vc_redist.x86.exe"
InstallArgs = "`"$Path\vc_redist.x86.exe`" /quiet /norestart"
},
@{
Name = "Visual C++ Redistributable x64"
Link = "https://aka.ms/vs/17/release/vc_redist.x64.exe"
File = "vc_redist.x64.exe"
InstallArgs = "`"$Path\vc_redist.x64.exe`" /quiet /norestart"
}
)
foreach ($App in $Downloads) {
Write-Host "Downloading $($App.Name)..." -ForegroundColor Green
try {
Invoke-WebRequest -Uri $App.Link -OutFile "$Path\$($App.File)" -UseBasicParsing
Write-Host "Downloaded $($App.File) successfully" -ForegroundColor Green
Write-Host "Installing $($App.Name)..." -ForegroundColor Yellow
if ($App.File.EndsWith(".msi")) {
Start-Process -FilePath "msiexec.exe" -ArgumentList $App.InstallArgs -Wait
} else {
Start-Process -FilePath "cmd.exe" -ArgumentList "/c $($App.InstallArgs)" -Wait
}
Write-Host "$($App.Name) installed successfully" -ForegroundColor Green
}
catch {
Write-Host "Error with $($App.Name): $($_.Exception.Message)" -ForegroundColor Red
}
}