Wix Toolset: Create Sql Login
I'm Working on an Installer Based on Wix 3.9 Which Deploys a Database Along with Other Needed Files. the Installer Must Also Add a Login to the Sql Server with...
I'm working on an installer based on wix 3.9 which deploys a database along with other needed files. The installer must also add a Login to the SQL Server with sysadmin rights.
I have followed this thread with this code but I think that a local user is being created and definitely not an Login on my sql instance and unfortunately due to permissions I can't even access the CP to check for that. Any ideas would be helpful since I can't find any documentation on the issue.
<util:Group Id="Users"
Name ="Benutzer"
Domain="[ComputerName]" />
<Component Id ="CreateUserAccount"
Guid="AEE91491-99FA-40A9-AB47-1E9FC2DDEF2A"
Directory="TARGETDIR">
<util:User Id ="SQLUser"
Name="[DBUSER_PROP]"
Password="[DBPW_PROP]"
UpdateIfExists="no"
CreateUser="yes"
PasswordNeverExpires="yes"
PasswordExpired="no"
RemoveOnUninstall="no">
<util:GroupRef Id ="Users" />
</util:User>
2 Answers
User creates Windows users. If you want to create a SQL login, use SqlString or SqlScript to run a CREATE LOGIN query.
Turned out easier than I thought
<sql:SqlString Id="sql_us" ExecuteOnInstall="yes" SQL="CREATE LOGIN SQL_USER WITH PASSWORD = 'password', DEFAULT_DATABASE="master" , CHECK_POLICY= OFF;" Sequence="6"/>