How can I map a drive/port for all new users on a machine without scripts etc?

A. Using the following technique you can map some drives, then copy this change into the default user profile, then perform a little surgery.

Part I: create the Drive entries

  1. Log into your PC with your domain account (for arguments sake, you are "DoeJ" in the "Domain" Domain.)
  2. Map the "X:" drive to \\Server\Share$; Select Reconnect at Login (obviously you should use valid drive letters/shares for your own environment)

Part II: Get the entries into a REG file

  1. Log out, Log back in using a local administrator account.
  2. Launch REGEDIT32
  3. Go to the HKEY_USERS window
  4. Highlight the root key (HKEY_USERS)
  5. Select Registry | Load Hive
  6. Browse to the profile of your domain account (Probably: C:\Winnt\Profiles\DoeJ), select the NTUSER.DAT file; Give this hive the name "DefaultU"
  7. Notice that under the HKEY_USERS key that "DefaultU" has been added as a subkey.
  8. Launch REGEDIT (do not close REGEDT32)
  9. Browse to HKEY_USERS\DefaultU\Network\X, highlight the X.
  10. Export this key, noting where you save it to.
  11. Close REGEDIT (you cannot unload the hive if REGEDIT has it open)
  12. Highlight the DefaultU Hive in REGEDT32
  13. Select Registry | Unload Hive

Part III: Import the REG File to the Default User Profile

  1. Select Registry | Load Hive
  2. Browse to the profile of the Default User (Typically: C:\Winnt\Profiles\Default User), select the NTUSER.DAT file; Give this hive the name "DefaultU" 
    *Note: you must use the same name you used in step 6 in part II for this to work...
  3. Import the .REG file you exported in step 12 by double clicking it.

Part IV: Perform Surgery to convert a specific entry to a generic entry

  1. Browse to HKEY_USERS\DefaultU\Network\X, highlight the X.
  2. Select the UserName Value (it would now show a REG_SZ with "Domain\DoeJ" as its data)
  3. Delete it (The value, not just the data)
  4. Edit | Add Value: Value Name: "UserName" Data Type: "REG_EXPAND_SZ" String: "%UserDomain%\%UserName%" (Case Sensitive)
  5. Highlight the HKEY_USERS\DefaultU Parent Key and unload it (Select Registry | Unload Hive)

Part V: Test your results

  1. Temporarily rename the DoeJ profile.
  2. Log out as the local administrator and log back in with the Domain\DoeJ credentials. NT will not find your old profile (you renamed it in step 25), and so then copy the contents of Default user into a new DoeJ folder and use them.
  3. Notice that you have an X drive, and did not have to use net use or map it with explorer.
  4. Since you are now upset because you lost all your desktop and software settings, log out as your DoeJ account and then back in as the local admin. Rename the newly created DoeJ profile folder and Rename your original DoeJ profile back.

This technique can be used for many things, but I find it most useful for the printer LPT: ports and network drives on multi-user and KIOSK machines. Note that only users that do not have profiles already stored on the PC will be affected by this change. I will typically implement this when I am building a new PC for a common area where everybody and his brother will be logging into it; they can use their own credentials, with the ability to get to their home directories, instead of a generic machine specific account.

Thanks to Steven Yarnot for this


Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish