 
Set Variable ISWIN64 to FALSE
Get System Setting Windows in 64 bit Mode into ISWIN64
if Variable ISWIN64 Equals TRUE
  Comment: Switch to X64 native with 64 bit target OS 
  Comment: to force REGKEY commands x64 native mode
  Set x64 - Native 64 bit Windows, AMD64 and EM64T Architectures - installation mode
end
 
Set Variable SQL_INSTANCES to 
Find All Registry Values in HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL into SQL_INSTANCES
MessageBox: Debug, SQL_INSTANCES=$SQL_INSTANCES$
 
for each Element INSTANCE in $NEWLINE$ delimited Collection of $SQL_INSTANCES$ do
  Set Variable INSTANCE_KEY to 
  Read Registry Key HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL\$INSTANCE$ into INSTANCE_KEY
   
  Set Variable MS_SQL_EDITION to 
  Set Variable MS_SQL_VERSION to 
  Read Registry Key HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\$INSTANCE_KEY$\Setup\Edition into MS_SQL_EDITION
  Read Registry Key HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\$INSTANCE_KEY$\Setup\PatchLevel into MS_SQL_VERSION
  MessageBox: Debug, INSTANCE=$INSTANCE$$NEWLINE$MS_SQL_EDITION=$MS_SQL_EDITION$$NEWLINE$MS_SQL_VERSION=$MS_SQL_VERSION$
next
 
if Variable ISWIN64 Equals TRUE
  Comment: Switch back to x86 mode
  Set Win32 - Native 32 bit Windows and Windows 32 on Windows 64 (WOW64) - installation mode
end
 
 
