WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Networks - Servers
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Update All NT Existing/New User Registry Configurations

Keywords: 	  Update NT User Registry Configurations

Question:

My problem is that I need my winbatch setup program to write amongst other things a proxy server setting to a key under:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\.. etc
The problem is that I would also like to do this this for all existing users and new users. Then if they login the settings would be there for them too. However, it would seem that you can only write to the current user and not to all the SIDs under HKEY_USERS (if I could even see them) - is it possible to do this? In the meantime I am investigating using the run/runonce registry options but I don't really want to run a test program everytime a user logs in. Your advise and comments will be welcome. Many thanks.

Answer:

  1. For some keys found in hkey_current_user if they key is not there, then the machine inspects the hkey_local_machine version.

    In NT 4.0 the user sections of the regirstry are not even loaded so there is no access to them. In Windows 2000 there is a way - that we do not currently have support for - to get into those registry keys.

    For now it seems like you have to run a script each time a user logs in - at least till all the settings are in place.

  2. Actually, if you can locate the individual directory where each user's profile is stored (either a local profile or a roaming profile), you can load hte NTUSER.DAT and NTUSER.DAT.LOG files into the existing registry, make the mods and then unload the files.

    Here's how it works:

    For example, my laptop is not part of a domain so all of my profiles are local profiles for the 3 or 4 user accounts that I have created on the workstation. Under C:\WINNT\Profiles there is a subdirectory for each user profile. Within each of these subdirectories is a NTUSER.DAT file and a ntuser.dat.log file.

    What you need to do is to the following, assuming that my profile is as follows:

    
    MyProfile = "C:\WINNT\Profiles\choppc\NTUSER.DAT"
    RegLoadHive(@REGUSERS,"TEMPchoppc",MyProfile)
    
    Now, I can access my entire "HKCU" hive as a sub-branch of the registry under the HKU (@REGUSERS) hive when I look under the top-level registry key named "TEMPchoppc".

    Once I have made all of the desired changes, I then have to unload the hive file that I previously loaded. Do this as follows:

    
    RegUnloadHive(@REGUSERS,"TEMPchoppc")
    
    You could just as easily use @REGMACHINE instead of @REGUSERS if you wanted to.

    You MUST make sure that the key name you specify with RegLoadHive() does NOT already exist or you may encounter an error while attempting to load the hive at the specified top level key.

    Once you get the method working for a single user it is easy to set up a directory/file processing loop where you enumerate all of the profile directories and you then load/modify/unload the NTUSER.DAT file for each profile. Just make sure that you do NOT attempt to process the profile of the account that is currently logged on to the workstation since that user's NTUSER.DAT file is currently loaded under HKCU (@REGCURRENT).

    I use this method on WinNT to make make changes to the "Default User" and the "All Users" profiles to disable the Internet Explorer Welcome/Tips screen so that it will not appear each time a new profile is created on the workstation.

    On Win9x you don't have the option of loading a hive file. If user profiles are enabled then all the user profiles that are present on the machine are available under HKU (@REGUSERS). Please note that you can only update locally cached copies of roaming profiles if roaming profiles are enabled. When a roaming profile is used, it is copied from its network storage location when the user logs on to the workstation and then it gets copied back up to the network when the user logs off of the workstation sucessfully. This means that roaming profiles on Win9x machines cannot be directly manipulated if that user is not logged on to the workstation.

  3. If you're using a domain and all users who log on are running through a default logon script, you can simply add a
    
    regedit /s x:\blahblah\desiredsettings.reg
    
  4. Hkey_Users\.default\ 
    is the registry key on which all other profile keys for all users is built the First time they log in.. if you want global settings.. places your changes there :) for NT workstation... for IE.. the combination of .default and Hkey_LocalMachine\Software should do the trick..

  5. Just add it to the login script?

    See...

    Get List of User Profiles and Update Registry with User.Dats
    

Article ID:   W14630
Filename:   Update All NT Existing-New User Registry Configs.txt
File Created: 2014:07:18:09:51:38
Last Updated: 2014:07:18:09:51:38