switch from admin to standard user using powershell

Kuldeep Kaur 1 Reputation point
2022-05-31T15:24:14.713+00:00

Hi! I am trying to map a network drive but cannot from admin mode. I tried it from user mode it works. So I need powershell to switch from admin to standard user. Any help would be appreciated.
Thanks

Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 60,161 Reputation points
    2022-05-31T18:02:32.34+00:00

    You cannot do that. Once a process is created its "elevation status" is fixed. To use a different user or (un)elevate a process you have to spawn the new process. When spawning the new process you have to tell it the user account to use otherwise it'll run in the same context as the existing user.

    Admins can have mapped network drives. Changing the elevation won't fix your problem. More likely your problem is one of process isolation in that you are trying to map drives in one process and access them in another. That isn't going to work unless both processes are being run under the same user account (and elevation).

    Ideally you should just use UNC paths and forget mapped drives altogether. They generally aren't worth the trouble.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.