While it is not really the way I would like to do it, I did find a workaround. While using the following code does not tell me if an instance is an x32 or x64 instance of SQL, it does properly detectd and list all instances of SQL.
SQLcount = [color=#004000];Initiate blank variable[/color]
SQLTcount = [color=#004000];Initiate blank variable[/color]
Loop, HKLM, System\Currentcontrolset\Services, 2 [color=#004000];Parses the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services registry keys[/color]
{
ifinstring, A_LoopRegName, MSSQL [color=#004000];If the Registry key contains MSSQL, parse it, otherwise, loop to the next key[/color]
{
IfNotInString, A_loopRegName, ServerADHelper [color=#004000];Strips out the ServerADHelp keys, they are related to an instance, but not the instance its self[/color]
{
SQLcount = %SQLcount%%A_LoopRegName%`n [color=#004000];Saves the returned Vaule to the current list of discovered instances[/color]
SQLTcount += 1 [color=#004000];Incriments the number of instances counter[/color]
}
}
}
StringReplace, SQLcount, SQLcount, MSSQL,,All [color=#004000];Parses the instances names into a user frinedly format[/color]
StringReplace, SQLcount, SQLcount, $,,All [color=#004000];Parses the instances names into a user frinedly format[/color]
if SQLTcount = 1 [color=#004000];If the number of SQL instances discovered is only one[/color]
{
RegRead, installSQL, HKLM, SOFTWARE\Microsoft\Microsoft SQL Server\ALAMODE\Setup, SQLPATH [color=#004000];Check to see if the ALAMODE instance is already installed[/color]
if installSQL = [color=#004000];If this entry is blank, the ALAMODE instance is not installed[/color]
{
MsgBox, 262192, Warning, Another instance of SQL was found on the system:`n%SQLcount%`nSQL repair will still be able to install the alamode `ninstance of SQL`; However`, it will not perform the preclean`nprocess prior to install because of possible conflicts with`nother installed versions of SQL. , 30
If override != 1 [color=#004000];If the user did not choose to override the default safety features preventing the uninstallation of other instances of SQL[/color]
Install = 1 [color=#004000];Set the utility to install mode instead of repair, (Uninstall/reinstall) mode[/color]
}
}
else if SQLtCount > 1 [color=#004000];If the number of SQL instances discovered is greater than one[/color]
{
RegRead, installSQL, HKLM, SOFTWARE\Microsoft\Microsoft SQL Server\ALAMODE\Setup, SQLPATH [color=#004000];Check to see if the ALAMODE instance is already installed[/color]
if installSQL = [color=#004000];If this entry is blank, the ALAMODE instance is not installed[/color]
{
MsgBox, 262192, Warning, Another instance of SQL was found on the system:`n%SQLcount%`nSQL repair will still be able to install the alamode `ninstance of SQL`; However`, it will not perform the preclean`nprocess prior to install because of possible conflicts with`nother installed versions of SQL. , 30
If override != 1 [color=#004000];If the user did not choose to override the default safety features preventing the uninstallation of other instances of SQL[/color]
Install = 1 [color=#004000];Set the utility to install mode instead of repair, (Uninstall/reinstall) mode [/color]
}
else [color=#004000];If another instance of SQL and the ALAMODE instance both exist, cannot continue. (Override command would bypass this, but will remove ALL instances of SQL)[/color]
{
MsgBox, 131088, Error, More than one instance of SQL has been detected on this machine:`n%SQLcount%`nThis utility is unable to automatically repair/reinstall The `na la mode instance of SQL if another instance of SQL is present. `n`nPlease contact a tech to repair SQL manually.`nThis utility will now close.
if override != 1 [color=#004000]; Allows override option to bypass the detection of multiple instances of SQL (Will cause all other instances of SQL to be lost)[/color]
{
Exitapp
}
}
}
MsgBox, 64, No instances of SQL Detected, No instances of SQL were dected`, SQLrepair will operate normally. [color=#004000];Should only display if the above logic cannot detect ANY installed instance of SQL on the machine, x32 or x64.[/color]
Exitapp
(\__/) This is Bunny.
(='.'=) Copy and paste Bunny onto your signature.
(")_(") Help Bunny gain World Domination.