Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Uninstall Slack x64 - "Machine wide" MSI installer
- $AppName = "Slack Machine-Wide"
- # Sweep installed apps and pull the uninstall string.
- # This is meant to solve the problem of uninstalling auto-patched apps. with automation.
- # Secunia will auto-apply new MSIs, which changes the string.
- # The config manager client can unisntall with this script, with no regard to the version that's actually installed.
- ##################################################################
- # Kill processes.
- $ProcessName = "Slack"
- Get-Process | ? {$_.name -eq $ProcessName} | % {$_ | Stop-Process -Force -Verbose}
- #######################################################
- ## Look for both architectures.
- #$UninstallRoot = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
- $UninstallRoot = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
- # Find the first app which matches the name. Be careful to make it find the corret one, in case more than one app matches.
- # ! ! ! no wildcards this time.
- $AppInfo = Get-ChildItem -Path $UninstallRoot | Where-Object {$_.getValue("displayname") -eq ($AppName)} | Select-Object -First 1
- $Version = $AppInfo.GetValue("DisplayVersion")
- $LogFile = $env:TEMP + "\" + $AppName + "_" + $Version + "-Uninstall.log"
- $AppGuid = $AppInfo.PSChildName
- # With all this information, run the uninstall command.
- & MsiExec /x $AppGuid /q /norestart /log $LogFile | Wait-Process
Add Comment
Please, Sign In to add comment