How to get DefaultInstance when bootstrapping SQL Server 2005 Express - sql-server-2005

I'm able to install SQL Server 2005 Express with the bootstrapper, but I can't seem to be able to install the default instance.
I have tried
<Property Id="SQLInstance" Value="MSSQLSERVER" />
<ExePackage Id="SQL2005Express" DisplayName="SQL Server 2005 EXPRESS" Cache="yes" Compressed="yes"
InstallCondition="not SqlInstanceKeyFound"
DetectCondition="SqlInstanceKeyFound"
PerMachine="yes" Permanent="yes" Vital="yes" Name="SQLEXPR.EXE" SourceFile="$(var.ThirdToolsSrc)\SQLEXPR.EXE"
InstallCommand="/qn ADDLOCAL=All SECURITYMODE=SQL [SqlVariable] DISABLENETWORKPROTOCOLS=0 INSTANCENAME=[SQLInstance]">
<ExitCode Value ="3010" Behavior="forceReboot" />
</ExePackage>
This will create an instance [MACHINENAME]\SQLEXPRESS, I tried without specifying the InstanceName parameter but got the same result.
Looking at this page, I don't see what I can change to be able to add the default instance.
I want to have the DefaultInstance to be [MachineName] only
Thanks.

Finally, I figured what was causing the problem, event though it seems a bit weird to me, but I was able to get the required result.
ORIGINAL CODE
<ExePackage Id="SQL2005Express" DisplayName="SQL Server 2005 EXPRESS" Cache="yes" Compressed="yes"
InstallCondition="not SqlInstanceKeyFound"
DetectCondition="SqlInstanceKeyFound"
PerMachine="yes" Permanent="yes" Vital="yes" Name="SQLEXPR.EXE" SourceFile="$(var.ThirdToolsSrc)\SQLEXPR.EXE"
InstallCommand="/qn ADDLOCAL=All SECURITYMODE=SQL [SqlVariable] DISABLENETWORKPROTOCOLS=0 INSTANCENAME=[SQLInstance]">
MODIFIED CODE (Working)
I didnèt think that the order of the parameters were important , but it seems that they are.

Related

WiX bundle RegistrySearch always fails

I am trying to use a registry search in a WiX bundle to detect if the Microsoft Access Database Engine is installed and then conditionally install it based on the result:
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Office\14.0\Access Connectivity Engine" Result="exists" Variable="AccessDbInstalled" />
<PackageGroup Id="AccessDb">
<ExePackage
Id="AccessDb14"
Cache="no"
Compressed="yes"
PerMachine="yes"
Permanent="yes"
Vital="yes"
SourceFile="Prereqs\AccessDatabaseEngine_X64.exe"
InstallCommand="/quiet /norestart"
InstallCondition="NOT AccessDbInstalled">
</ExePackage>
</PackageGroup>
However the log shows the registry search as always failing, even though I can plainly see the key in the registry:
[77E4:51D8][2021-10-14T16:45:11]i000: Registry key not found. Key = 'SOFTWARE\Microsoft\Office\14.0\Access Connectivity Engine'
[77E4:51D8][2021-10-14T16:45:11]i000: Setting numeric variable 'AccessDbInstalled' to value 0
I have other registry searches that work fine, just not this one?!
Add Win64="yes". The search defaults to the 32-bit registry hive. You need to tell Burn you want the 64-bit registry.

.NET 4.5.2 conditions in a Wix bundle

I'm working on a Wix project to learn more about Wix. I'm trying to configure my Wix bundle to detect and install .NET 4.5.2 but I'm a little confused. I've seen a lot of examples where the registry is checked but I wanted to know if I can do something like this:
<Chain>
<PackageGroupRef Id="NetFx452Redist" />
<ExePackage Id="Netfx452"
Cache="no"
Compressed="yes"
PerMachine="yes"
Permanent="yes"
Vital="yes"
InstallCommand="/q /norestart"
SourceFile="$(var.ProjectDir)Resources\NDP452-KB2901907-x86-x64-AllOS-ENU.exe"
DetectCondition="NetFx452"
InstallCondition="NOT NetFx452" />
<MsiPackage Id="ShittyMsi"
SourceFile="$(var.MyInstaller.TargetDir)"
Name="$(var.MyInstaller.TargetFileName)" />
</Chain>
If I can't do this and I need to check the registry, how do I know what I need to be looking for in the registry?
You're already using <PackageGroupRef Id="NetFx452Redist" /> so you don't need to check the registry; the package group already takes care of checking the registry and setting the right attributes.

SQL Express 2014 instance not removed on uninstall

I am trying to set up an installation, with sql express 2014 as a prerequisite. The installation itself works fine, but when uninstalling, the instance is not removed. I can still access it through my sql manager and find it in the registry.
This is my Chain:
<Chain>
<ExePackage
Id="Netfx4Full"
Name="dotNetFx40_Full_x86_x64.exe"
Cache="no"
Compressed="no"
PerMachine="yes"
Permanent="yes"
Vital="yes"
SourceFile="packages\dotNetFx40_Full_x86_x64.exe"
DownloadUrl="https://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe"
DetectCondition="Net4FullVersion AND (NOT VersionNT64 OR Net4x64FullVersion)"
InstallCondition="(VersionNT < v6.0 OR VersionNT64 < v6.0) AND (NOT (Net4FullVersion OR Net4x64FullVersion))">
</ExePackage>
<PackageGroupRef Id="Sql2014Express"/>
<RollbackBoundary />
<MsiPackage Id="MainPackage" SourceFile="MyApplication.msi" DisplayInternalUI="yes" Compressed="yes" Vital="yes" />
</Chain>
This is my ExePackage:
<PackageGroup Id="Sql2014Express">
<ExePackage Id="SQL2014Expressx64"
InstallCondition="VersionNT64 AND NOT SQL2014x64InstanceInstalled"
SourceFile="packages\SQLEXPR_x64_ENU.exe"
DownloadUrl="$(var.SqlWebLink64)"
DisplayName="Installing Microsoft SQL Express 2014"
InstallCommand="/ACTION=Install /INSTANCENAME=$(var.InstanceName) /FEATURES=SQLENGINE /Q /HIDECONSOLE /SkipRules=RebootRequiredCheck /IAcceptSQLServerLicenseTerms /SQLSVCSTARTUPTYPE=Automatic /SQLSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE" /AGTSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE" /ASSYSADMINACCOUNTS=BUILTIN\Administrators /SQLSYSADMINACCOUNTS=BUILTIN\Administrators /BROWSERSVCSTARTUPTYPE=Disabled /ADDCURRENTUSERASSQLADMIN=true /TCPENABLED=1"
UninstallCommand="/Action=Uninstall /INSTANCENAME=$(var.InstanceName) /FEATURES=SQLENGINE /Q /HIDECONSOLE"
Cache="yes"
Vital="yes"
Compressed="no"
PerMachine="yes"
Permanent="no"/>
...
</PackageGroup>
From what i understand, the Permanent="no", should take care of removing the package on uninstall. I have even included and UninstallCommand, but this does not remove the instance either.
What am I missing here?
Let me know if any other info is required to solve this. - Thx!
Exe packages require a DetectCondition to be able to verify whether or not the package is installed. If you notice in your .net exepackage you have
DetectCondition="Net4FullVersion AND (NOT VersionNT64 OR Net4x64FullVersion)"
This tells the installer that this package is installed iff the condition is true. You have to do the same thing in your SQL exe package.
DetectCondition is
A condition that determines if the package is present on the target system. This condition can use built-in variables and variables returned by searches. This condition is necessary because Windows doesn't provide a method to detect the presence of an ExePackage. Burn uses this condition to determine how to treat this package during a bundle action; for example, if this condition is false or omitted and the bundle is being installed, Burn will install this package.
You can do this by creating some registry searches which set some variables. Try this registry search
<util:RegistrySearch
Id='MicrosoftSQLInstalledCheck'
Root='HKLM'
Key='SOFTWARE\Microsoft\Microsoft SQL Server\$(var.InstanceName)\Setup'
Win64='yes'
Value='SQLPath'
Result='exists'
Variable='MicrosoftSQLInstalled'/>
Then in your ExePackage for SQL you can put DetectCondition="MicrosoftSQLInstalled" and that will be true if the registry search found the SQLPath registry entry in the key specified.

Wix: Determine if SqlLocalDB is installed

I'm trying to determine is it LocalDb installed and i tried to go the way from this link Determine if SqlLocalDB is installed
But i've got an error on my log file that: Registry key not found. Key = 'SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL12E.LOCALDB\MSSQLServer\CurrentVersion'
My code is:
<util:RegistrySearch Id="SearchForLocalDB"
Root="HKLM"
Key="SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL12E.LOCALDB\MSSQLServer\CurrentVersion"
Value="CurrentVersion"
Variable="LocalDBVersion"
Result="value"/>
<PackageGroup Id="LOCALDB">
<MsiPackage Id="LOCALDB"
DisplayName="Microsoft SQL Server 2014"
Permanent="yes"
Visible="yes"
DisplayInternalUI="yes"
SourceFile=".\SqlLocalDB.msi"
InstallCondition="(LocalDBVersion <= "12.0")"
/>
</PackageGroup>
Use Result='exists' rather than pulling the actual value. You already have the version in the key value so you don't need to check for it in the InstallCondition.

How to Upgrade Prerequisite software Ms SQL server using Wix

My application Requires MS SQL Server as one of its Prerequisite.Now i want to upgrade the client machine to MS SQL Server 2008 R2 express edition if they have MS SQL Server 2005 express edition. i am unable to implement it. below is the Wix code i am using for downloading and installing MS SQL server 2008 R2 express edition when no SQL server is installed on client machine.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Fragment>
<util:RegistrySearch Root="HKLM"
Key="SOFTWARE\Microsoft\Microsoft SQL Server\MyInstanceName"
Variable="Instance"
Result="exists"
/>
<PackageGroup Id="SqlServer2008R2">
<ExePackage InstallCommand='/q /action=INSTALL /HIDECONSOLE /IACCEPTSQLSERVERLICENSETERMS=1 /FEATURES=SQLEngine /INSTANCENAME=MyInstanceName /SQLSVCACCOUNT="NT AUTHORITY\SYSTEM" /SECURITYMODE=SQL /SAPWD=abc#Wd1234 /ADDCURRENTUSERASSQLADMIN=TRUE /SQLSYSADMINACCOUNTS="NT AUTHORITY\SYSTEM" /TCPENABLED=1 /NPENABLED=1'
InstallCondition="NOT VersionNT64"
DetectCondition="Instance"
Compressed="no"
Vital="yes"
PerMachine="yes"
Name="SQLEXPR32_x86_ENU.exe"
Permanent="yes"
Cache="no"
DownloadUrl="http://download.microsoft.com/download/5/1/A/51A153F6-6B08- 4F94-A7B2-BA1AD482BC75/SQLEXPR32_x86_ENU.exe"
>
<RemotePayload
Size="60995936"
ProductName="Microsoft SQL Server 2008 R2 Express"
Description="Microsoft SQL Server 2008 R2 Express"
Version="10.50.1600.1"
CertificatePublicKey="672605E36DD71EC6B8325B91C5FE6971390CB6B6"
CertificateThumbprint="9617094A1CFB59AE7C1F7DFDB6739E4E7C40508F"
Hash="ACF5494D18EDF117A2683D66A96FB8954F98D86D"
/>
</ExePackage>
</PackageGroup>
</Fragment>
</Wix>
You cannot use the /action=INSTALL parameter for upgrading an instance only installing a new one. You will have to create another ExePackage with the /action=UPGRADE and setup the InstallCondition to choose the correct one based on the registry searches you do:
<ExePackage Id="SqlExpress2008R2_UpgradeNamedInstance"
Cache="no"
Compressed="no"
PerMachine="yes"
Permanent="no"
Vital="yes"
InstallCommand="/QS /ACTION=Upgrade /IACCEPTSQLSERVERLICENSETERMS /BROWSERSVCSTARTUPTYPE=Automatic /INSTANCENAME="[SqlInstance]""
Name="redist\SQLEXPR_x86_ENU.exe"
DownloadUrl="http://download.microsoft.com/download/D/1/8/D1869DEC-2638-4854-81B7-0F37455F35EA/SQLEXPR_x86_ENU.exe"
InstallCondition="SqlInstance AND SqlServerInstalled AND NOT SQLServer2008R2Installed">
<RemotePayload ProductName="SQL Server 2008 R2 Express SP1"
Description="SQL Server 2008 R2 Express SP1"
CertificatePublicKey="5C499B10F7EF186DC729991A262AB52066423909"
CertificateThumbprint="93859EBF98AFDEB488CCFA263899640E81BC49F1"
Hash="6F399D641F322A3E47E3DD605F2A2EDF21074375"
Size="111274848"
Version="10.50.2500.0" />
</ExePackage>