1

I'm trying to create an installer with WiX that has a step that writes to a network drive via a UNC path, but no matter what I do, I run into the error "Could not access network location":

enter image description here

The network location in question exists and is accessible to the installer process.

Here's what I've tried:

  • Specifying the Directory in question via SetDirectory:
<SetDirectory Action="SetInstallDir" Id="INSTALLFOLDER" Value="\\tsclient\Z\VMSharedFolder\Docs">INSTALLFOLDER=""</SetDirectory>
  • Specifying the Directory in question via the command-line:
msiexec /i Wixv3.msi INSTALLFOLDER="\\tsclient\Z\VMSharedFolder"
  • Using a Directory that isn't actually used in the installation (MYPERSONALFOLDER below); note I also tried rooting this Directory to the well-known folder one-level up as suggested here:
<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFiles64Folder">
    <Directory Id="INSTALLFOLDER" Name="WixV3">
      <Component Id="test" Guid="95AB91F2-7DFE-4D1C-8114-BF1D07AD440C" Win64="yes" >
        <File Id="test.txt" Source="Files\test.txt" KeyPath="yes" Checksum="no"/>
      </Component>
    </Directory>
  </Directory>

  <Directory Id="MYPERSONALFOLDER" Name="WillBeReplaced"/>
</Directory>

<SetDirectory Action="SetInstallDir" Id="MYPERSONALFOLDER" Value="\\tsclient\Z\VMSharedFolder\Docs">MYPERSONALFOLDER=""</SetDirectory>
  • Setting WIXUI_DONTVALIDATEPATH via the command-line:
msiexec /i Wixv3.msi WIXUI_DONTVALIDATEPATH="1"  
  • Setting WIXUI_DONTVALIDATEPATH in XML:
<Property Id="WIXUI_DONTVALIDATEPATH" Value="1" />
  • Using a "special" folder that points to the network drive path - in this case, My Documents. Note that this is the actual production scenario for my application and the reason this came up in the first place - some of our users have their My Documents folder on a network drive.
<Directory Id="PersonalFolder" Name="UserHomeDocuments"/>
  • Upgrading to Wix 5 - I tried some but not all of the above workarounds on Wix 5. For example, the "special folder" solution looks like this:
<StandardDirectory Id="PersonalFolder" />

But none of the above solutions worked; they all fail with the same error message as above. Which leads me to conclude that WiX or MSI installers in general have a problem with UNC paths / network drives in general. This leaves me all the more confused as this seems to be a supported scenario (from searching on the internet).

Could anyone tell me what's actually going on here and what the underlying problem is? As I mention above, I can't avoid the need to write to a network drive as we have a use-case for that.

1
  • Is there a difference in result between running msiexec from an admin shell (so that it does not present an admin rights prompt) and running it from a regular shell (with prompt)? The latter case likes to run as either two different users or as one user with two different tokens (admin and regular), and this occasionally causes split brain. Commented May 12, 2024 at 16:10

1 Answer 1

0

Installing files to a network drive is not a supported scenario, because the installer installs files under a special local system account that does not have access to the network (for security reasons). Also, your mapped drive exists in the logged-in user context only, as far as I understand.

It does not matter under which user you start the installer, and that the user has access to that location; the installer will switch to "system" context when installing files. The terminal server drive is mounted for the current user, so it will simply "missing" in the system context. Check out the "two-phases" installation for MSI. On the first pass, a script of required actions is generated (in user context); on the second pass, this script is executed (in system context)

If you want to copy some file under the current user account, you can, but you may need to do that explicitly using a custom action that should run in the current user context (i.e. to have "Elevated" set to "no"). Depending on your requirements, you could also try to enable network drive access for the local system installer service; but that may require doing it on all computers where you plan to install your app, and could be a security breach.

Sign up to request clarification or add additional context in comments.

2 Comments

This might explain what I'm seeing - do you have any documentation to back up that this isn't a supported scenario?
I was unable to find any reference to an official Microsoft site confirming that installing to a terminal server mapped network drive with MSI is not a supported scenario, sorry. So you can consider the above as IMHO.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.