After a successful compiled application, I transferred the executable to a network drive with the post-build event in VS. Every time I start my project, it is opened under my user credential but it needs administrators privilege to run like expected. So VS ask me if I want to close VS and restart it under admin privilege. After that, VS looses my connected network drives because it runs under administrator, not my own credential. If I go in command prompt with admin privilege and type "Net Use" command, there is no network drives attached. After mapping the missing drives, VS is able to compile like expected.
Now, my question is, when I go to command prompt with admin privilege, what is my credential? If I type "whoami", I get my own user name but it is not totally true because there is no mapped network drives like under command prompt without admin privilege. Even if my user is under local administrators group...
We can add a value in the registry to synchronize mapped network drives between linked tokens. This is documented under Some Programs Cannot Access Network Locations When UAC Is Enabled in TechNet:
The registry key is
The
EnableLinkedConnections
value is aDWORD
set to 1 to share mapped drives between linked tokens or to 0 for the default behaviour.