A problem may occur if you need to access the network drive using the mapped drive letter (X:) instead of absolute path from the WinAutomation or a compiled Process that runs elevated (a.k.a. as administrator).
To understand why the network drive is not visible to the programs running as administrator, we have to consider how Windows handles the standard and administrator user access internally. In simple terms, when UAC (User Account Control) is enabled, Windows creates a split personality for your user account:
One with the standard user’s access rights to do the the regular tasks, and
another one with the full administrative access to the system.
When you log in to the computer, Windows tries hard to create the impression that these two personalities are the same: they share the login name and password, the desktop and documents, settings and preferences, and so on. However, when it comes to mapping the network drives, Windows prefers to treat them as separate accounts (for security reasons). That’s why the network drives created when you wear the hat of the standard user do not automatically become available when you put the administrator’s hat on. This Microsoft article explains it all in detail.
As a workaround:
– You can use the absolute path \\serverName\folderPath instead of its mapped letter X:
– You can run command line (CMD.exe) as administrator and execute the command net use driveLetter: “\\serverName\folderPath” before accessing the drives