Hi guys, I am trying to uninstall an application on a remote server using uninstallstring, a property of Get-ItemProperty cmdlet in PowerShell, but failing to do so. I have also tried suggestions explained in another thread, click here to access the thread, however, my following script still do not uninstall the program, so please have a look.
I was so embarrassed when you pointed out my silly mistake Chance F, however, when I checked my actual script, the location was correct there. Therefore, the mistake occurred while tweaking the text of the script on the textbox, before posting this thread. I have edited the script of the original post.
You can print the uninstall string and check if its happening when you use the same in cmd with elevated permissions. For some applications I’ve seen that uninstall string doesn’t work as is.
Yes, I have tried running uninstall string in command prompt, elevated permissions, and I received UAC prompt in order to proceed the uninstall. So, is there any way to bypass UAC in PowerShell to accomplish this task?
To get around UAC, try running the MSIEXEC command . if you run the script as the local SYSTEM account, in that case it shouldn’t ask for UAC and all remote commands are actually running under the SYSTEM account.
So, can use below line in your code and try Example:
MSIEXEC /quiet /x $($app.uninstallstring)
Yes, I have been searching ways to bypass UAC, but didn’t find any workable suggestion\solution.
Moreover, I was trying to create an answer file in order to capture the inputs from the uninstall process, and thereby executing uninstall.exe, the file where uninstallstring points to, silently. However, I am unsuccessful so far.
Thanks for the post Evila, the suggestion didn’t work. Although the example you gave didn’t return any error in PS ISE or command prompt, the application was still on the computer.
This would only work if you installed via MSI. There isn’t an official MSI for Notepad++.
<hr />
On a side note, if you did have an MSI install and you wanted it to uninstall I would suggest running the following first. It would allow you to see the exact name you would need to uninstall the MSI package