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

John Savill

December 13, 1999

3 Min Read
ITPro Today logo in a gray background | ITPro Today

A. Using the following technique you can map some drives, then copythis 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 \ServerShare$; 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:WinntProfilesDoeJ), 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_USERSDefaultUNetworkX, 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:WinntProfilesDefault 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_USERSDefaultUNetworkX, highlight the X.

  2. Select the UserName Value (it would now show a REG_SZ with "DomainDoeJ" 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_USERSDefaultU 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 DomainDoeJ 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 theprinter LPT: ports and network drives on multi-user and KIOSK machines. Notethat only users that do not have profiles already stored on the PC will beaffected by this change. I will typically implement this when I am building anew PC for a common area where everybody and his brother will be logging intoit; they can use their own credentials, with the ability to get to their homedirectories, instead of a generic machine specific account.

Thanks to Steven Yarnot for this

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like