Forum Discussion
Unistall Program script Intune
Hello hugo566788
Welcome to the Microsoft community, my name is Recep I'll be happy to help you today.
Instead, you can use the following script to uninstall CCleaner through PowerShell:
$ProgramName = 'CCleaner'
$uninstallString = Get-ItemProperty -Path "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" |
Where-Object { $_.DisplayName -eq $ProgramName } |
Select-Object -ExpandProperty UninstallString
if ($uninstallString -ne $null) {
try {
Write-Host "Uninstalling $ProgramName..."
Start-Process "msiexec.exe" -ArgumentList "/x $uninstallString /qn" -Wait
Write-Host "$ProgramName successfully uninstalled."
} catch {
Write-Error "Error uninstalling $ProgramName: $_"
}
} else {
Write-Host "$ProgramName is not installed."
}
This script uses the registry to find the uninstall string for CCleaner and then executes the uninstallation silently using msiexec.exe. Please make sure to test this script in a controlled environment before deploying it to a larger number of devices.
If I have answered your question, please mark your post as Solved If you like my response, please give it a Like Appreciate your Kudos! Proud to contribute! 🙂 |