I'm attempting to write a batch script that will search the registry and add the value of the UninstallString within a key into a variable.
There are a few caveats:
- The keys may be different on different workstations (depends on installer used, multiple modified MSI versions exist for samesoftware version)
- There is the main product with patches installed
- The patches must be uninstalled first before the main product
For example, the Cisco Supervisor Desktop software may have the following keys:
Patch 3
KEY: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall{981E3887-9D55-4B91-B643-7155AA98C906}
DisplayName value: Cisco Desktop Services 8.5(4) Maintenance Release 4 Engineering Special 6
UninstallString value: MsiExec.exe /X{981E3887-9D55-4B91-B643-7155AA98C906}
Patch 2
KEY: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall{4FA5AFA8-FDEB-43C9-83B7-43092593ACDF}
DisplayName value: Cisco Desktop Services 8.5(4) Maintenance Release 4 Engineering Special 4
UninstallString value: MsiExec.exe /X{4FA5AFA8-FDEB-43C9-83B7-43092593ACDF}
Patch 1:
KEY: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall{CA941834-837E-44C2-BF83-E7E7558FDD61}
DisplayName value: Cisco Desktop Services 8.5(4) Maintenance Release 4
UninstallString value: MsiExec.exe /X{CA941834-837E-44C2-BF83-E7E7558FDD61}
Main product:
KEY: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
DisplayName value: Cisco Supervisor Desktop
UninstallString value: MsiExec.exe /X{AB60EBDC-45A9-4764-96CB-EFCE4AD0C10B}
They must be uninstalled in that order. There is also the potential for other keys to be in the registry when multiple versions are installed.
I would think a search function could be created for the patches using DisplayName value Cisco Desktop Services since it's common for all the patches then a separate search for the Cisco Supervisor Agent.
I currently have WMIC commands but sometimes they can be extremely slow to run while if I manually run the UninstallString value it completes quickly. I have also had instances where the WMIC command will not uninstall the product when the UninstallString value will.