The machine is a terminal server. Windows Server 2012 a.k.a. Windows 8.
These are the MSI log lines of interest. Specifically the ‘wrong context’.
MSI (s) (88:A4) [11:25:47:730]: Created Custom Action Server with PID 5344 (0x14E0).
MSI (s) (88:A8) [11:25:47:754]: Running as a service.
MSI (s) (88:A8) [11:25:47:757]: Custom Action Server rejected - Wrong Context
MSI (s) (88:A4) [11:25:47:760]: CA Server Process has terminated.
MSI (s) (88:BC) [11:25:47:760]: Failed to get IMsiCustomAction*
11/05/2021 11:25:47.761 : Assembly Install: Failing with hr=80070005 at RemoveDirectoryAndChildren, line 393
Custom MSI actions & terminal server wrong context is a known thing apparently, introduced as an issue around Windows 7 / Server 2008 times with some updates to Windows Installer.
The issue seems particularly common with ODBC related packages, and I suspect this is because there are separate User and System contexts for ODBC configurations. Something is getting confused somewhere.
People say to revert various Windows Updates to downgrade the Windows Installer version.
Unfortunately none of that could be applied here for this Server 2012 machine – all the discussion I found was around Server 2008 / Windows Vista/7.
The other suggested workaround of using psexec did work though, and after a day of fighting this, it will do.
psexec -s -i msiexec /i "c:\users\administrator\Downloads\Sage Accounts 27_2\packages\Sage50Accounts_DataAccess.msi"
Don’t forget you need the full path, because the task runs in a new session / environment as the system account, and will not have the current working directory as its working directory.
If you are installing the whole thing rather than just the DataAccess components, leave off the msiexec /i and just call the installer executable:
psexec -s -i "c:\users\administrator\Downloads\Sage Accounts 27_2\install.exe"