Deploy SourceTree Enterprise
Asked by Julian M?ller:

Hey there,

I am trying to integrate SourceTree into our software deployment cycle and encountered a problem with the current way the SourceTree installer is working.

We are deploying software via a window service that is run as the user "system".

It is not possible for us to install via a system user. The deployment works when it is run as a local user of the machine.

I think it might be connect to the fact that enviroment variables are not resolved and in turn the installer cannot be unpacked. Sadly the flag "INSTALLDIR" does not resolve the problem for us.

The second thing that I noticed is that the installer does not return an appropriate %errorlevel%. It always returns "0" and signals that the install was successful.

Hope somebody can help us with that.

Regards.


Answers:
author: minnsey
body: Hi  

I'm assuming you are using the MSI version of the installer? Can you provide some more details on how you are running it.  

I'm guessing overall its because it is trying to install to the c:\\program files (x86) folder but the system user isn't a local admin? Hence you are trying to over ride that path using INSTALLDIR?

comments: author: julian mueller
body: Thanks for replying

Yes I am using the MSI installer. I am running it as part of a script through msiexec. The user "system" is part of the operating system as explained [here](https://support.microsoft.com/de-de/help/120929/how-the-system-account-is-used-in-windows). I tried overwriting it because it did not automatically switched it to a useful path. It used the appdata path of system which is "C:\\Windows\\System32\\config\\systemprofile\\AppData\\"

Regards.


author: minnsey
body: Thanks  

What error do you get? If you run as Admin on a workstation directly,. with your preferred params does it all work?


author: Julian M?ller
body: Hey Michael

Yes the installer does work when run with a normal user that has admin privileges (e.g my user and the Administrator user).

But in my circumstance it is not possible to run the script through another user


author: minnsey
body: OK,  

I can't suggest a quick fix, but if you can provide some additional context, why you have to use the user, the restrictions it has etc, we can investigate. We do **not** use SCCM-like tools directly so there may well be some limitations we are not aware of.  

thanks


author: Julian M?ller
body: Here is some context:

We are using a software called WPKG to deploy software. It is basicly an service that calls a .js file which is on a network share. To not go into detail: This in turn runs commands that are specified on that share (such as msiexec \[...\]). As per default windows services are run with the local system account. So each following command is executed as system aswell.

If requested I can hand over a verbose log file. I don't want to post ist here as it is quiet large and contains private information.


author: Julian M?ller
body: Okay I found the problem but for me it does not make a lot of sense:

As specified in the INSTALLDIR global flag it does try to install to "C:\\Program Files\\Sourcetree". The folder does not exist bevor trying to install it.

The installer throws an Error (This can only be found in the verbose log of the msiexec itself) "Error 1303: The installer has insufficient privileges to access this directory"

This comes from the SYSTEM user missing in the NTFS permissions. This should not happen because the script is run in an elevated context so the user is able to write there anyway.

My solution for now is manually creating the appropriate folder and adding the user to the NTFS permissions. After doing that the install will run successfully.

This should be fixed imo. It is the first msi package which does throw this error.

Regards,

Julian


author: minnsey
body: Thanks  

I've just created <https://jira.atlassian.com/browse/SRCTREEWIN-11149> to track this.


Tags: sourcetree-enterprise