title: Database permissions issue using MSI/WIX 3.5
body: <p>I've created a WIX DB installer. It works on my DEV machine using SQLEXPRESS but not on my test machine using (local). I confirmed that the server is correct in each case, using Orca. The following, is pretty much what I'm using, only with a few more scripts. the scripts are known to work fine, and if I take them out altogether, it still fails.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' 
       xmlns:util='http://schemas.microsoft.com/wix/UtilExtension' 
       xmlns:sql='http://schemas.microsoft.com/wix/SqlExtension'&gt;
  
    &lt;?include $(sys.CURRENTDIR)\Config.wxi?&gt;
    &lt;?include ..\Common.wxi?&gt;
  
    &lt;Product Name='Agent Desktop $(var.SVCNAME)-$(var.ProductVersion)-$(var.BranchName)' Id='*' UpgradeCode='$(var.UpgradeCode)'
      Language='1033' Codepage='1252' Version='$(var.ProductVersion)' Manufacturer='$(var.ProductManufacturer)'&gt;
  
      &lt;Package Id='*'
               Keywords='Installer'
               Description="$(var.ProductManufacturer) $(var.SVCNAME)-$(var.ProductVersion)-$(var.BranchName) Installer"
               Comments='Premier Contact Point and PCP are registered trademarks of $(var.ProductManufacturer)'
               Manufacturer='$(var.ProductManufacturer)'
               InstallerVersion='100'
               Languages='1033'
               Compressed='yes'
               SummaryCodepage='1252' /&gt;
  
      &lt;Upgrade Id="$(var.UpgradeCode)"&gt;
        &lt;UpgradeVersion
            Minimum="1.0.0.0" Maximum="99.0.0.0"
            Property="PREVIOUSVERSIONSINSTALLED"
            IncludeMinimum="yes" IncludeMaximum="no" /&gt;
  
      &lt;/Upgrade&gt;
      &lt;InstallExecuteSequence&gt;
        &lt;RemoveExistingProducts Before="InstallInitialize" /&gt;
      &lt;/InstallExecuteSequence&gt;
  
  
      &lt;Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" /&gt;
      &lt;Property Id='DiskPrompt' Value="Premier Contact Point $(var.DBNAME)-$(var.ProductVersion)-$(var.BranchName) Installer [1]" /&gt;
  
          &lt;Directory Id="TARGETDIR" Name="SourceDir"&gt;
              &lt;Directory Id="ProgramFilesFolder"&gt;
          &lt;Directory Id="PremierTechnologies" Name="$(var.ProductManufacturer)"&gt;
                    &lt;Directory Id="INSTALLLOCATION" Name="PCP $(var.DBNAME)-$(var.ProductVersion)-$(var.BranchName)"&gt;
  
              &lt;Component Id='SqlComponent' Guid='YOUR-GUID-HERE'&gt;
                &lt;sql:SqlDatabase Id='SqlDatabase' Database='$(var.DBNAME)-$(var.ProductVersion)-$(var.BranchName)' 
                                 Server='$(var.DbServer)' CreateOnInstall='yes' DropOnUninstall='yes' ConfirmOverwrite='no' ContinueOnError='no'&gt;
  
                  &lt;sql:SqlScript Id='Script0001' Sequence='01' BinaryKey='Script0001' ExecuteOnInstall='yes' /&gt;
  
                &lt;/sql:SqlDatabase&gt;
  
              &lt;/Component&gt;
            &lt;/Directory&gt;
  
          &lt;/Directory&gt;
              &lt;/Directory&gt;
          &lt;/Directory&gt;
  
      &lt;Binary Id='Script0001' SourceFile='../../DatabaseUpdater/UpgradeScripts/Script0001.sql' /&gt;
  
      &lt;Feature Id='SqlFeature' Title='SqlFeature' Level="1"&gt;
        &lt;ComponentRef Id='SqlComponent' /&gt;
      &lt;/Feature&gt;
  
    &lt;/Product&gt;
  &lt;/Wix&gt;
  </code></pre>
  
  <p>It installs OK on my local machine using (local)/SQLEXPRESS, but when I try to install it to a SQL std machine using '.' or '(local)', with Windows authentication, I get the dreaded <code>Error 26201. failed to create SQL database</code> error.</p>
  
  <p>I invoked the MSI from a powershell script like so:</p>
  
  <pre><code>start-process "msiexec.exe" "/i Database.msi /l*v Database-install.log" -wait
  </code></pre>
  
  <p>And in the log file I got the following error details. (I read that a few lines of context on either side of the 'value 3' line is often enough to diagnose the error, but I can't see a solution from it):</p>
  
  <pre><code>MSI (s) (E4:70) [11:54:27:897]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 
  MSI (s) (E4:70) [11:54:27:897]: Executing op: Header(Signature=1397708873,Version=405,Timestamp=1025466054,LangId=1033,Platform=0,ScriptType=1,ScriptMajorVersion=21,ScriptMinorVersion=4,ScriptAttributes=0)
  MSI (s) (E4:70) [11:54:27:897]: Executing op: ProductInfo(ProductKey={59CBDFC0-F16D-492D-A46B-336421D7F2F2},ProductName=Agent Desktop DB-3.9.9.0-wix,PackageName=Database.msi,Language=1033,Version=50921481,Assignment=0,ObsoleteArg=0,,,PackageCode={A3E3E186-D9AF-46B9-90D8-8FB6217AC71F},,,InstanceType=0,LUASetting=0,RemoteURTInstalls=0,ProductDeploymentFlags=3)
  MSI (s) (E4:70) [11:54:27:897]: SHELL32::SHGetFolderPath returned: C:\Documents and Settings\andrewm.PCPDEV\Application Data
  MSI (s) (E4:70) [11:54:27:897]: Executing op: DialogInfo(Type=0,Argument=1033)
  MSI (s) (E4:70) [11:54:27:897]: Executing op: DialogInfo(Type=1,Argument=Agent Desktop DB-3.9.9.0-wix)
  MSI (s) (E4:70) [11:54:27:897]: Executing op: RollbackInfo(,RollbackAction=Rollback,RollbackDescription=Rolling back action:,RollbackTemplate=[1],CleanupAction=RollbackCleanup,CleanupDescription=Removing backup files,CleanupTemplate=File: [1])
  MSI (s) (E4:70) [11:54:27:897]: Executing op: SetBaseline(Baseline=0,)
  MSI (s) (E4:70) [11:54:27:897]: Executing op: SetBaseline(Baseline=1,)
  MSI (s) (E4:70) [11:54:27:897]: Executing op: ActionStart(Name=ProcessComponents,Description=Updating component registration,)
  MSI (s) (E4:70) [11:54:27:897]: Executing op: ProgressTotal(Total=1,Type=1,ByteEquivalent=24000)
  MSI (s) (E4:70) [11:54:27:897]: Executing op: ComponentRegister(ComponentId={A53B47BD-FFCD-4A7B-BF6D-E5356B0AD76A},KeyPath=C:\Program Files\Premier Technologies\PCP AgentDesktop-3.9.9.0-wix\,State=3,,Disk=1,SharedDllRefCount=0,BinaryType=0)
  MSI (s) (E4:70) [11:54:27:913]: Executing op: ActionStart(Name=InstallFiles,Description=Copying new files,Template=File: [1],  Directory: [9],  Size: [6])
  MSI (s) (E4:70) [11:54:27:913]: Executing op: InstallProtectedFiles(AllowUI=1)
  MSI (s) (E4:70) [11:54:27:913]: Executing op: ActionStart(Name=CreateDatabase,Description=Creating Databases,)
  MSI (s) (E4:70) [11:54:27:913]: Executing op: CustomActionSchedule(Action=CreateDatabase,ActionType=25601,Source=BinaryData,Target=**********,CustomActionData=**********)
  MSI (s) (E4:60) [11:54:27:913]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSID7.tmp, Entrypoint: CreateDatabase
  CreateDatabase:  Error 0x80004005: failed to create to database: 'AgentDesktop-3.9.9.0-wix', error: unknown error
  MSI (c) (CC:08) [11:54:44:584]: Font created.  Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg
  
  Error 26201. Error -2147467259: failed to create SQL database: AgentDesktop-3.9.9.0-wix, error detail: unknown error.
  MSI (s) (E4!6C) [11:54:46:444]: Product: Agent Desktop DB-3.9.9.0-wix -- Error 26201. Error -2147467259: failed to create SQL database: AgentDesktop-3.9.9.0-wix, error detail: unknown error.
  
  Action ended 11:54:46: InstallFinalize. Return value 3.
  MSI (s) (E4:70) [11:54:46:459]: User policy value 'DisableRollback' is 0
  MSI (s) (E4:70) [11:54:46:459]: Machine policy value 'DisableRollback' is 0
  MSI (s) (E4:70) [11:54:46:475]: Executing op: Header(Signature=1397708873,Version=405,Timestamp=1025466062,LangId=1033,Platform=0,ScriptType=2,ScriptMajorVersion=21,ScriptMinorVersion=4,ScriptAttributes=0)
  MSI (s) (E4:70) [11:54:46:475]: Executing op: DialogInfo(Type=0,Argument=1033)
  MSI (s) (E4:70) [11:54:46:475]: Executing op: DialogInfo(Type=1,Argument=Agent Desktop DB-3.9.9.0-wix)
  MSI (s) (E4:70) [11:54:46:475]: Executing op: RollbackInfo(,RollbackAction=Rollback,RollbackDescription=Rolling back action:,RollbackTemplate=[1],CleanupAction=RollbackCleanup,CleanupDescription=Removing backup files,CleanupTemplate=File: [1])
  MSI (s) (E4:70) [11:54:46:475]: Executing op: ActionStart(Name=CreateDatabase,Description=Creating Databases,)
  MSI (s) (E4:70) [11:54:46:475]: Executing op: ProductInfo(ProductKey={59CBDFC0-F16D-492D-A46B-336421D7F2F2},ProductName=Agent Desktop DB-3.9.9.0-wix,PackageName=Database.msi,Language=1033,Version=50921481,Assignment=0,ObsoleteArg=0,,,PackageCode={A3E3E186-D9AF-46B9-90D8-8FB6217AC71F},,,InstanceType=0,LUASetting=0,RemoteURTInstalls=0,ProductDeploymentFlags=3)
  MSI (s) (E4:70) [11:54:46:491]: SHELL32::SHGetFolderPath returned: C:\Documents and Settings\andrewm.PCPDEV\Application Data
  MSI (s) (E4:70) [11:54:46:491]: Executing op: ActionStart(Name=InstallFiles,Description=Copying new files,Template=File: [1],  Directory: [9],  Size: [6])
  MSI (s) (E4:70) [11:54:46:491]: Executing op: ActionStart(Name=ProcessComponents,Description=Updating component registration,)
  MSI (s) (E4:70) [11:54:46:491]: Executing op: ComponentUnregister(ComponentId={A53B47BD-FFCD-4A7B-BF6D-E5356B0AD76A},ProductKey={59CBDFC0-F16D-492D-A46B-336421D7F2F2},BinaryType=0,)
  MSI (s) (E4:70) [11:54:46:491]: Executing op: End(Checksum=0,ProgressTotalHDWord=0,ProgressTotalLDWord=0)
  MSI (s) (E4:70) [11:54:46:491]: Error in rollback skipped.  Return: 5
  MSI (s) (E4:70) [11:54:46:491]: No System Restore sequence number for this installation.
  MSI (s) (E4:70) [11:54:46:491]: Unlocking Server
  MSI (s) (E4:70) [11:54:46:491]: PROPERTY CHANGE: Deleting UpdateStarted property. Its current value is '1'.
  Action ended 11:54:46: INSTALL. Return value 3.
  Property(S): DiskPrompt = Premier Contact Point AgentDesktop-3.9.9.0-wix Installer [1]
  Property(S): UpgradeCode = {79DB4D69-D287-4441-8148-40E270729E21}
  Property(S): CreateDatabase = SqlDatabase?.??AgentDesktop-3.9.9.0-wix?3?1???0?0
  Property(S): ExecuteSqlStrings = SqlDatabase?.??AgentDesktop-3.9.9.0-wix?3?1???Script0001?1?create table dbo.SchemaVersions 
  </code></pre>
  
  <p>I've tried everything I can think of, or that is mentioned in the WIX discussion forums (and here) but nothing works. I assume that the error is truly a permissions issue, but the account I'm using has sysadmin permissions in the DB I'm trying to install to.</p>
  
  <p>Can you think of, or have you heard of, any other ways that the SqlDatabase installer CA in WIX can fail like this?</p>