Dekes Posted November 6, 2014 Posted November 6, 2014 (edited) Hello, I need some help figuring out how to uninstall Microsoft SQL 2005 Express. Apparently SQL 2005 have 5 different program installed with independent uninstall string. So far I was able to run the uninstall string and it will click yes for me, then after it finishes uninstalling one of five program, it will do nothing. I'm not sure what I'm missing writing this codes. Any suggestion? expandcollapse popup; Disabling the Icon in Systray. Opt("TrayIconHide", 1) ;If the (Microsoft SQL Server 2005) is installed, Uninstalling. $var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\UNINSTALL\{B0F9497C-52B4-4686-8E73-74D866BBDF59}", "DisplayName") If $var = "Microsoft SQL Server 2005" Then ShellExecuteWait("msiexec.exe", "/x {B0F9497C-52B4-4686-8E73-74D866BBDF59}") WinWait("Windows Installer") WinActivate("Windows Installer") ControlClick("Windows Installer", "","[CLASS:Button; INSTANCE:1]") EndIf ;If the (Microsoft SQl Server Native Client) is installed, Uninstalling. $var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\UNINSTALL\{7670D32F-DAE6-4E49-8C8B-B3F08B5B1686}", "DisplayName") If $var = "Microsoft SQl Server Native Client" Then ShellExecuteWait("msiexec.exe", "/x {7670D32F-DAE6-4E49-8C8B-B3F08B5B1686}") WinWait("Windows Installer") WinActivate("Windows Installer") ControlClick("Windows Installer", "","[CLASS:Button; INSTANCE:1]") EndIf ;If the (Microsoft SQL Server Management Studio Express) is installed, Uninstalling. $var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\UNINSTALL\{4A7A3985-3D9B-4420-AC85-F9FF8DB2170C}", "DisplayName") If $var = "Microsoft SQL Server Management Studio Express" Then ShellExecuteWait("msiexec.exe", "/x {4A7A3985-3D9B-4420-AC85-F9FF8DB2170C}") WinWait("Windows Installer") WinActivate("Windows Installer") ControlClick("Windows Installer", "","[CLASS:Button; INSTANCE:1]") ;Another message box prompting to make sure if I want to proceed. WinWait("Microsoft SQL Server Management Studio Express") WinActivate("Microsoft SQL Server Management Studio Express") ControlClick("Microsoft SQL Server Management Studio Express", "","[CLASS:Button; INSTANCE:1]") EndIf ;If the (Microsoft SQL Server VSS Writer) is installed, Uninstalling. $var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\UNINSTALL\{E7084B89-69E0-46B3-A118-8F99D06988CD}", "DisplayName") If $var = "Microsoft SQL Server VSS Writer" Then ShellExecuteWait("msiexec.exe", "/x {E7084B89-69E0-46B3-A118-8F99D06988CD}") WinWait("Windows Installer") WinActivate("Windows Installer") ControlClick("Windows Installer", "","[CLASS:Button; INSTANCE:1]") EndIf ;If the (Microsoft SQL Server Setup Support Files (English)) is installed, Uninstalling. $var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\UNINSTALL\{53F5C3EE-05ED-4830-994B-50B2F0D50FCE}", "DisplayName") If $var = "Microsoft SQL Server Setup Support Files (English)" Then ShellExecuteWait("msiexec.exe", "/x {53F5C3EE-05ED-4830-994B-50B2F0D50FCE}") WinWait("Windows Installer") WinActivate("Windows Installer") ControlClick("Windows Installer", "","[CLASS:Button; INSTANCE:1]") ;Another message box prompting to make sure if I want to proceed. WinWait("Microsoft SQL Server Setup Support Files (English)") WinActivate("Microsoft SQL Server Setup Support Files (English)") ControlClick("Microsoft SQL Server Setup Support Files (English)", "","[CLASS:Button; INSTANCE:1]") EndIf ;If the (Microsoft SQL Server 2005 Tools) is installed, Uninstalling. $var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\UNINSTALL\{58D379F7-62BC-4748-8237-FE071ECE797C}", "DisplayName") If $var = "Microsoft SQL Server 2005 Tools" Then ShellExecuteWait("msiexec.exe", "/x {58D379F7-62BC-4748-8237-FE071ECE797C}") WinWait("Windows Installer") WinActivate("Windows Installer") ControlClick("Windows Installer", "","[CLASS:Button; INSTANCE:1]") EndIf ; Installing (SQL Server Express 2012 ADV) ShellExecuteWait("setup.exe", "/configurationfile=installconfigfile.ini") Edited November 6, 2014 by Dekes
jguinch Posted November 6, 2014 Posted November 6, 2014 (edited) ShellExecuteWait executes a program and waits for the program finishes. In you case, you should use ShellExecute instead. To make a silent (un)installation, you can add a MSI parameter to your commands : ShellExecuteWait("msiexec.exe", "/x {53F5C3EE-05ED-4830-994B-50B2F0D50FCE} /qb") ; /qb or /qn (type msiexec /? in a command line prompt to see the different parameters) You can also try my _>UninstallList function to search all registry keys/values specific to a given DisplayName (or part of DisplayName) Local $aList = _UninstallList("DisplayName", "SQL Server", 1, 3) For $i = 1 To $aList[0][0] RunWait ( $aList[$i][3] & " /qb") Next Edited November 6, 2014 by jguinch Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now