35

My Windows 7 computer is connected to a Windows network at the workplace. There are two domains in use on this network, EMPLOYEES and TESTERS. I have logins on both domains, for example EMPLOYEES\Joe and TESTERS\TestJoe.

If I am logged into a computer as EMPLOYEES\Joe, how do I launch a Windows Explorer instance with the privileges of TESTERS\TestJoe? Note that I can switch user and login as TESTERS\TestJoe on this computer without any problem.

I have tried the suggestions given in this post, and they do not work.

7 Answers7

21

You don't need to run explorer.exe as a different user just to connect to a network share with different credentials.

In an explorer window you can click on "Map network drive", fill in the path and and make sure to check "Connect using different credentials". When you click the finish button you will get prompted for the credentials you want to use to connect the current share.

You can also accomplish this with the net command on the command line.

net use x: \\server\share /user:testuser@example.com password
Paxxi
  • 7,186
18

It seems that Windows actively resists the ability to launch Explorer as a different user. I resolved this issue on my Windows 7 system by doing the following:

  1. take ownership of reg key HK_CLASSES_ROOT\AppID\{CDCBCFCA-3CDC-436f-A4E2-0E02075250C2}, and grant yourself Full Control. This key controls how Explorer is allowed to launch
  2. rename the subkey from runas to _runas. If you receive an error doing this, then you probably didn't complete step one correctly

Once this is changed, you can launch Explorer with a different set of credentials via the runas command or with the freeware tool CPAU from Joeware.

From command prompt, you can then launch Explorer:

  • with runas
    • runas /user:domain\username "c:\windows\explorer.exe /separate"
    • followed by completing the password prompt.
  • with cpau
    • cpau.exe /u domain\username /p password /ex "E:\Windows\explorer.exe /separate"

Note:

  • You have to use the Explorer option /separate to force Explorer to launch as a separate process. see also
  • The advantage of using cpau over runas is that with cpau, you can specify username and password in the command prompt.
  • Other than using cpau for my own use, I am not affiliated with Joeware.
Pang
  • 1,017
Ro Yo Mi
  • 393
14
  • Go to the Start button;
  • Type in Explorer;
  • Shift Right-Click "Windows Explorer";
  • Run as different user.

That user will also need privileges to access the file system on the local machine, and perform any futher operations you'd like to execute.

Diogo
  • 30,792
Matt
  • 157
8

This works for Windows 7, 8.0, 8.1 and 10

  1. Start the Registry Editor as an Administrative User.
  2. Navigate to, take ownership of, and grant yourself Full Control permission to the key HKEY_CLASSES_ROOT\AppID\{CDCBCFCA-3CDC-436f-A4E2-0E02075250C2}
  3. Rename the value RunAs to _RunAs.
  4. Close Regedit.
  5. Create a shortcut on the Desktop to C:\Windows\Explorer.exe
  6. Right-click the shortcut and choose Run as administrator. This will open Explorer in the security context of the Administrator.
0

Open Task Manager and End Task on explorer.exe

From File use 'Run New Task'

In the Run window type: runas /user:domain\username explorer.exe

When you press enter a CMD window should open prompting for the password of the elevated user.

Once entered you can confirm what user is running the Explorer.exe in Task Manager

0

Here is command line batch script if somebody needs one click solution. You'll need to put SubInACL.exe in the folder with script (get it here from Microsoft).

@echo off
Setlocal EnableDelayedExpansion
:check_admin
NET FILE 1>NUL 2>NUL
IF ERRORLEVEL 1 (
    cls
    echo Starting as admin ...
    powershell "saps -filepath %0 -verb runas" >nul 2>&1
    exit
)
cls

:set_privileges
rem Enable explorer to run privileged, src: https://superuser.com/a/591082/145585

echo Setting permissions ...
rem change owner to Administrators
rem should report: Done:        1, Modified        1, Failed        0, Syntax errors        0
%~dp0subinacl.exe /noverbose /statistic /subkeyreg "HKEY_CLASSES_ROOT\AppID\{CDCBCFCA-3CDC-436f-A4E2-0E02075250C2}" /setowner=administrators >nul 2>nul

rem give Administrators full permission
rem should report: Done:        1, Modified        1, Failed        0, Syntax errors        0
%~dp0subinacl.exe /noverbose /statistic /subkeyreg "HKEY_CLASSES_ROOT\AppID\{CDCBCFCA-3CDC-436f-A4E2-0E02075250C2}" /grant=administrators=f >nul 2>nul

echo Rename registry entry ...
powershell -ExecutionPolicy Bypass -Command "Rename-ItemProperty -Path 'Registry::HKEY_CLASSES_ROOT\AppID\{CDCBCFCA-3CDC-436f-A4E2-0E02075250C2}' -Name 'RunAs' -NewName '_Runas' -ErrorAction SilentlyContinue"

:run_explorer
echo Starting explorer ...
start "" /MAX "c:\windows\explorer.exe" "%~dp0"
Stritof
  • 160
-1

shift and right click the .exe to see the option in question or from CLI runas /user:"domain\username" "whatever"