Who is the user when running under administrator privilege?

158 views Asked by At

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...

1

There are 1 answers

1
Guibson On BEST ANSWER

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:

To work around this problem, configure the EnableLinkedConnections registry value.

The registry key is

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System

The EnableLinkedConnections value is a DWORD set to 1 to share mapped drives between linked tokens or to 0 for the default behaviour.