0

I know how to map a network drive using net use and psexec. Out of convenience for my users, I don't want to make them do anything, really. Just request the share and that's it. I want to do the rest without inconveniencing their work at all - in the background. I don't want to change their password to use net use x: \\server\where\share\is\ -u username -p password. I don't really want to make them download a BAT file. I could transfer a BAT file to their Desktop using psexec -s. However, That still requires them to click on a file and interact with technology I love, but they hate LOL.

How do I map a network drive to another user on the computer if I am logged in as an admin with SYSTEM permissions because of psexec -s?

I know the Registry is a database of configurations, I researched and read so many articles about it and blogs, but cannot find anything that discusses copying or moving registry configurations from one folder to another one. I researched the web about this, and need to find out if it can be done manually, which I can then script. But, I don't know how. Do I just do that with Windows Explorer or use move to move its supporting files.

Here is what I have in mind:

  1. net use x: \share\name /persistent:yes (makes the drive available to my profile)
  2. Read HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

However using reg query /v "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" I get ERROR: Invalid key name. and if done without /ve or /v, I get ERROR: The system was unable to find the specified registry key or value.; however, using regedit.exe, I can browse to it.

  1. Parse the target username and find its user ID under HKEY_USERS
  2. Move the drive letter information from my profile because using psexec -s used my admin profile on the computer, HKEY_USERS\{S-S-WHATEVER}\Blah\Network\X to the target user's registry folder in HKEY_USERS\S-S-WHATEVER2\blah\Network\

Technet does not explain this and neither does any article I found in the last 3 hours.

Thank you for your help! If you help me get the commands right, that would be amazing, and I will give you a $ tip if that is legal on SOF.

host_255
  • 361
  • 2
  • 7
  • 18
  • Even if you were to successfully add the relevant registry entries, the user would need to log off and back on for them to have any effect. Nor can `psexec` help you in this case as far as I can see. Perhaps you could write a program or script that starts automatically when the user logs on and runs in the background, and have that program automatically run batch files you drop in a particular folder? – Harry Johnston Dec 10 '16 at 02:52
  • That's a great idea and maybe a little easier. However, dropping files in folders requires an entire approval process here. With the `/persistent:yes` option, won't that work persist a logoff / reboot? Because I can live with that. Also, I am technically curious as to how to accomplish this with making changes to the registry. Please enlighten me. I am willing to tip for the lesson. – host_255 Dec 12 '16 at 04:44
  • Network drives mappings are local to the user's logon session. Running a program in another user's logon session is complicated, search on WTSQueryUserToken for examples. (The psexec tool can run code in a specified Remote Desktop session, but that's not the same thing.) – Harry Johnston Dec 12 '16 at 05:42
  • @HarryJohnston Thank you for that information. It perhaps makes more sense to have the user run a Batch file I place on their Desktops. Still is less steps than opening File Explorer -> This PC -> Map Network Drive, copying/pasting location, etc. – host_255 Dec 13 '16 at 07:12

0 Answers0