This content is not available in your preferred language.

The content is shown in another available language. Your browser may include features that can help translate the text.

Error When Accessing a Mapped Network Drive

Updated Jul 10, 2019

Reported In

Software

  • TestStand
  • LabVIEW

Issue Details

  • I am receiving Error 7: File Not Found when I try to open a file on a Mapped Network Drive using a static or programmatic file path. If I navigate to the file using the file dialog, the error no longer occurs, even if I use a static or programmatic file path.  When I restart my computer, the error returns.  Why is this happening?

 
  • I am deploying a TestStand application in a Mapped Network Drive and I get a message saying: Error <Drive>:\ is not a valid drive or network location. Make this location available, then run the installer again.
  • If I use File Dialogs that are prompted by LabVIEW (for example: File >> Open in the Project Explorer or a VI) I cannot see any Network Drives when I navigate to My Computer.

Solution

1. Run either LabVIEW or TestStand as an administrator. This should give LabVIEW the proper permissions to access the mapped drive, see additional notes for more details.
2. If that does not work, please follow the following Microsoft knowledge base article. This article shows you how to change the Microsoft UAC settings in the registry to allow LabVIEW to access mapped network drives. Make sure to save a copy of your registry before making any changes.
 

Additional Information

The problem here is related to the functionality of Windows User Account Control, and the Run as Administrator option.  When User Account Control is on, and a user has administrator rights, the user actually has two accounts.  One account has normal user rights, and the other has administrator rights.  During normal operation, the user operates in the normal account, but when the Run as Administrator option is used, the processes for the program using this option are run in the administrator account.

This is normally not an issue, except in the case of mapped network drives.  As a security feature, Windows only allows mapped network drives to be accessed by the users that map them.  This becomes a problem when a program that uses the Run as Administrator option needs to access a mapped network drive.  When the program looks for a specified file on the mapped network drive, it fails to find the file because in the administrator account, the drive it is referencing does not exist.

The reason that this error disappears when you navigate to the file using a file dialog is that by navigating to the network drive, you are implicitly mapping it for the administrator account.  Once this happens, the file can be found and the error will not be seen until the drive is unmapped, either by disconnecting from the network or restarting the computer.

Below is a KnowledgeBase article from Microsoft describing the issue in detail.  The article is written for Microsoft Vista, but the behavior is the same in Windows 7 & 10.  There is also a workaround described, but it is not supported by Microsoft as it may make your computer vulnerable.