MSIEXEC fails to install package on EBS Windows instance
Asked by danere:

I'm using a stock image "Default Image EBS x86_64 (windows)" to attempt to build my database project file.

As part of my build plan, I am attempting to install an MSI package (in this case, a SQL Server Native Client) that is a dependency of my MsBuild project file.

To try and accomplish this, I'm calling the following command in my pre-build target:

```
msiexec /package http://go.microsoft.com/fwlink/?LinkID=239647 IACCEPTSQLNCLILICENSETERMS=YES /quiet
```

This should silently install the package so that my build will work. However what I'm getting instead is the following error:

```
The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.
```

Any ideas why this might be happening?


Answers:
author: Przemek Bruski
body: It may be a permissions issue - the agent runs as Bamboo user. You can rewire it to other user. This will probably be helpful: <https://confluence.atlassian.com/display/BAMBOO/Creating+a+custom+elastic+image+-+Windows> . The linked page describes the process used to set up the image you're running.

comments: author: danere
body: That makes sense, although I was hoping to just use the default image. To give you a bit of context, I am writing a blog post on setting up SQL Server database builds with Bamboo and I was hoping to keep the barrier to entry low (read = minimal lead time/number of steps).

Are there any alternatives to creating a custom image? If not I might have a crack at sourcing the dependencies through NuGet rather than installing them onto the EBS instance.


author: Przemek Bruski
body: Hmm, maybe you could use an instance setup script (check your image configuration page in Bamboo) and run the command via runas ? You'd still need to run runas with /savecred first and save the image (make sure you run prepareInstanceForSaving.bat first) - but at least that does not sound overly complicated.


author: danere
body: That could work. Actually after playing with this some more I've realised there's a couple more things I'd like on the image which can take a while to install. So I've decided against installing things during build and my latest thought is to create a public AMI with the dependencies pre-installed. Is this something you would recommend?


author: Przemek Bruski
body: Yeah, that sounds like a valid case where you'd want a custom image.


author: Nic Brough -Adaptavist-
body: Have you tested it outside Bamboo? Does the user running the agent have the rights to use the installer?

comments: author: danere
body: Sorry I should have mentioned, yes I tried it outside of Bamboo and it worked. So as you say it seems like an access rights issue, however I don't know what the agent runs as (I presume it's SYSTEM however I can't see a Bamboo agent service listed on the instance).


author: Nic Brough -Adaptavist-
body: I've only installed Bamboo once on a Windows box, and we created a user for it to run as, so we knew that permissions were down to "what that user could do".

I don't remember it running as "system", but I'm really not sure. It's definitely worth working it out. Even if you can't see "bamboo", have a look through the users for anyone running java.


Tags: cloud