Running powershell script to uninstall software from Control Panel

Topics: Archive - General
Feb 6, 2015 at 2:37 AM
Hi,

I pushed a registry key with set-registrykey to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall!Vcredist2005_Frv1 as uninstallstring.
C:\Program Files\xxx\yyyyyyyyyyyy\zzzzzzzz\Vcredist2005_Frv1Vcredist2005_Frv1_DesInstMan.ps1
But everytime I am trying to run the script from Control Panel, I get an error. I am sure the powershell script is working as I ran it from Powershell.

But from commandline, it is not working.

So I tried:
powershell.exe -executionPolicy bypass -noexit -file"C:\Program Files\xxx\yyyyyyyyyyyy\zzzzzzzz\Vcredist2005_Frv1Vcredist2005_Frv1_DesInstMan.ps1"

It is working from command prompt but not from control panel.
  1. What should I do to make it work from control panel?
  2. Do I need to add the "" at start and end of then commandline? If so, how may I do it with set-registrykey?
Thanks,
Coordinator
Feb 12, 2015 at 12:50 PM
Hi, not really a PSADT question. Does your uninstall string contain the full command? i.e. powershell.exe -executionPolicy bypass -noexit -file "C:\Program Files\xxx\yyyyyyyyyyyy\zzzzzzzz\Vcredist2005_Frv1Vcredist2005_Frv1_DesInstMan.ps1"
Feb 12, 2015 at 4:48 PM
Hi,

Finally, I found to successfully remove a software by running.

"UninstallPath"="C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -file C:\test\Vcredist2005_Frv1_DesInstMan.ps1"
"UninstallString"="C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -file C:\test\Vcredist2005_Frv1_DesInstMan.ps1"