JimDel
JimDel

Reputation: 4359

Why does running with elevated privileges force the use of UNC paths?

Why does running with elevated privileges force the use of UNC paths? I need to elevate my process AND keep the drive mappings I have. Yet when I run elevated the mappings are replaced with the UNC path. For example:

textBoxPath.Text = Application.StartupPath;

returns "F:\myProgram\tools" when run normally. But when run elevated it returns "\server\share\myProgram\tools"

I'd like to find a way to either convert the UNC to the mapped path or prevent it altogether.

Thanks

Upvotes: 1

Views: 433

Answers (1)

Joey
Joey

Reputation: 354864

The drive mappings are per-user. Your administrator user simply doesn't have the same mappings.

I fear there is no way to retain them, since, when elevated, you have a completely different user token.

Upvotes: 3

Related Questions