Uninstall "per-user" software
I installed an app called MailManager (which is great for filing emails in a multiuser environment) as a per user installation. I want to kill it and install it as a machine wide installation because I can't get my users to update it.
Here's a sample uninstall command, it returns a 1605 result
MsiExec.exe /qn /norestart /X{23795AD9-B9DC-4A0A-B080-D7B43494FC10}
I looked at this post and maybe this is my solution (it may come as no surprise that my powershell skills are primitive, to be generous!)
Looping an uninstall per user – Support (pdq.com)
so, does it read like this and I'm good to go? I plug this into a powershell step and my life is complete? Will this work for other machines that have the same version of the software installed or is the "USERAPP" specific to each machine?
Thanks for all the help!
#Define your value of "USERAPP" here
$userApp = "MsiExec.exe /qn /norestart /X{23795AD9-B9DC-4A0A-B080-D7B43494FC10}P"
#Get a list of all user profiles on the system
$path = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\*'
$profileList = Get-ItemProperty -Path $path | Select-Object -Property PSChildName, ProfileImagePath
#Run the command through all user profiles
foreach ($profile in $profileList) {
if (Test-Path $($profile.ProfileImagePath)\AppData\Local\$userApp\Update.exe) {
Invoke-Command "$($profile.ProfileImagePath)\AppData\Local\$userApp\Update.exe --uninstall -s"
}
}
#Close script with error code 0, indicating success
exit 0
Comments