We just went through a similar problem at my company. We needed to add a
..reg to users HKCU so they could have custom views for an app. Our GP
doesn't allow them to update their HKCU. We found a couple ways to do
it.
1. In regedit go to HKEY_Users and select File, load hive. Point to
that users ntuser.dat in Docs and settings and load the hive. Give the
key a name (i named it HKCU_Temp) Edit the registry setting to point to
the loaded hive When you run the .reg it will update the users HKCU and
you will see the change in the loaded hive. Unload the hive and when
they log on they will have that key. You can also do this from CMD with
the reg.exe commands.
2. We then automated it with a script. You can add computer names to a
text file and the script will look in Docs and Settings and edit the
ntuser.dat for all users on that machine including Default Users (so
every new user will have the correct entry). If a ntuser.dat is in use
it will report the error and move on.
REM ************************************************** *******
REM * %%p is PC Name *
REM * %%v is the User Profile *
REM ************************************************** *******
REM
REM ************************************************** *******
REM * yourbat.bat > "C:\outputfile.rpt.txt" *
REM ************************************************** *******
@echo off
REM
************************************************** *******************
REM * Target PCs are identified in "C:\pcfile.txt" *
REM
************************************************** *******************
for /f "tokens=* delims=" %%p in ('TYPE "C:\pcfile.txt"') do (
(ECHO %%p >> "C:\outpufile.txt"
)
REM
************************************************** *******************
REM * User Profiles are identified in "\\%%p\C$\Documents and Settings"
*
REM
************************************************** *******************
(for /f "tokens=* delims=" %%v in ('dir /ad /b "\\%%p\C$\Documents and
Settings"') do (
(@ECHO **************
(@ECHO Current PC: %%p
(@ECHO %%v
(@ECHO **************
REM
************************************************** *******************
REM * The remote PC registry hive is loaded, and then the HKey Current
*
REM * User is modified in the NTUSER.DAT that is found in each users
*
REM * profile in C:\Documents and Settings\Profile\NTUSER.DAT
*
REM *
*
REM * Then the remote PCs hive is unloaded. This process is then
*
REM * repeated for each profile. The "for" loop is then completes.
*
REM
************************************************** *******************
(REG LOAD HKU\HKCU_temp "\\%%p\C$\Documents and
Settings\%%v\NTUSER.DAT"
(regedit /S "C:\yourregistryfile.reg
(REG UNLOAD HKU\HKCU_temp
)
)
)
)
)
)
)
)
(@ECHO ******************************************
(@ECHO ******************************************
)
)
)
)
)
REM *** END ***
Just change where it says yourbat.bat, outputfile.txt, pcfile.txt, and
yourregistryfile.reg to reflect the names of your files.
Hope this helps
--
dmvtech
------------------------------------------------------------------------
dmvtech's Profile:
http://forums.techarena.in/members/dmvtech.htm
View this thread:
http://forums.techarena.in/server-scripting/1040924.htm
http://forums.techarena.in