Re: Change registry for all users of a machine
- From: Gerry Hickman <gerry666uk@xxxxxxxxxxx>
- Date: Thu, 11 Aug 2005 21:39:02 +0100
Hi
Personally, I think the best way of doing it would depend on his setup, but he never clarified it.
Mats wrote:
you can do it in two other ways too
the easiest solution to this is to create a simple batch that runs a regfile. The regfile should contain the values to be changed for current user.
The batchfile should be something like regedit /S regfile.
Place the batch i n all user startup and it will apply the regchange every time a user logs on.
The more complex version would use a more advanced batch or vbscript to read a key first to check if the update has been applied. if the check fails it applies the uppdate and sets the check key to indicate that the update is complete for this user
"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@xxxxxxxxx> wrote in message news:u340lE3lFHA.3256@xxxxxxxxxxxxxxxxxxxxxxx
Hal Berenson wrote:
We need to apply a change to the registry for all user accounts on a PC,
and
we'd like to automate the process. We don't have access to their
machines
directly, so they need something they run from a privileged account that adds this key for all user accounts. The key itself (.reg listed below)
is
defined as being in HKCU. So the question is, is there a place one can
make
this change in the registry and have it propagated to all users under
HKU?
Or would I need to write a script to loop through HKU and apply it to
all
the existing users?
Hi,
You will need to enumerate all the user profile folders, and load each user's NTUSER.DAT in a temporary hive and adding the registry value (using reg.exe that comes builtin with WinXP).
Here is a batch file that will set the registry value FilterQueueType to hex ffffffff (REG_DWORD) on all user accounts on the computer. You will of course need to run the batch file under an user account that have local admin privileges.
--------------------8<---------------------- @echo off setlocal
set regcmd=%SystemRoot%\system32\reg.exe set keypath=Software\Microsoft\Terminal Server Client\Default\AddIns\RDPDR set valuename=FilterQueueType
:: update current user set hive=HKCU set key=%hive%\%keypath% %regcmd% add "%key%" /v %valuename% /d 0xffffffff /t REG_DWORD /f >nul
:: update all other users on the computer, using a temporary hive set hive=HKLM\TempHive set key=%hive%\%keypath%
:: set current directory to "Documents and Settings" cd /d %USERPROFILE%\.. :: enumerate all folders for /f "tokens=*" %%i in ('dir /b /ad') do ( if exist ".\%%i\NTUSER.DAT" call :AddRegValue "%%i" ".\%%i\NTUSER.DAT" )
endlocal echo. echo Finished... echo. pause
goto :EOF
:AddRegValue set upd=Y if /I %1 equ "All Users" set upd=N if /I %1 equ "LocalService" set upd=N if /I %1 equ "NetworkService" set upd=N
if %upd% equ Y ( %regcmd% load %hive% %2 >nul 2>&1 %regcmd% add "%key%" /v %valuename% /d 0xffffffff /t REG_DWORD /f >nul
2>&1
%regcmd% unload %hive% >nul 2>&1 )
--------------------8<----------------------
-- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: http://www.microsoft.com/technet/scriptcenter/default.mspx
-- Gerry Hickman (London UK) .
- References:
- Change registry for all users of a machine
- From: Hal Berenson
- Re: Change registry for all users of a machine
- From: Torgeir Bakken \(MVP\)
- Re: Change registry for all users of a machine
- From: Mats
- Change registry for all users of a machine
- Prev by Date: Re: Maintaining user profiles with a fresh install of XP on a 2000 mac
- Next by Date: Re: Forcing Duplex settings
- Previous by thread: Re: Change registry for all users of a machine
- Next by thread: Bluetooth Devices
- Index(es):
Relevant Pages
|