Change registry for all users of a machine

  • Thread starter Thread starter Hal Berenson
  • Start date Start date
H

Hal Berenson

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?
 
I forgot to include the .reg. It is:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Terminal Server
Client\Default\AddIns\RDPDR]
"FilterQueueType"=dword:ffffffff
 
Hi,

I don't think you gave enough info. If this is TS environment, I have no
idea of the answer. If it's a romaing profiles environment, (not TS)
then I may have some ideas of where to start. If it's not roaming
profiles and it's not TS it's probably not worth wasting any time on.

What are the servers, what are the clients, what directory services
structure do you have, what o/s are you running etc.

Hal said:
I forgot to include the .reg. It is:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Terminal Server
Client\Default\AddIns\RDPDR]
"FilterQueueType"=dword:ffffffff
 
First, I do not use or know anything about Terminal Server.

Why not use HKEY_LOCAL_MACHINE? This affects all users on a machine.

[HKEY_LOCAL_MACHINE \Software\Microsoft\Terminal Server
Client\Default\AddIns\RDPDR]
"FilterQueueType"=dword:ffffffff

I am the only user on my machine, so I only have
HKEY_USERS\S-1-5-21-1708537768-1580436667-1202660629-1003

But anything changed in the HKEY_USERS\SID # key is also changed in the
HKEY_CURRENT_USER when that user is logged on and vice versa.

HKEY_USERS\SID # for each user\Software\Microsoft\Terminal Server
Client\Default\AddIns\RDPDR
"FilterQueueType"=dword:ffffffff

Are you referrencing one of these?

Printers That Use Ports That Do Not Begin With COM, LPT, or USB Are Not
Redirected in a Remote Desktop or Terminal Services Session
http://support.microsoft.com/default.aspx?scid=kb;en-us;q302361

Remote Desktop Connection software may cause an access violation if
FilterQueueType is set
http://support.microsoft.com/?kbid=329756

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
Hal Berenson said:
I forgot to include the .reg. It is:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Terminal Server
Client\Default\AddIns\RDPDR]
"FilterQueueType"=dword:ffffffff


--
Hal Berenson, President
PredictableIT, LLC


Hal Berenson said:
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?
 
Hal said:
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<----------------------
 
This is the article the registry change is based on:


--
Hal Berenson, President
PredictableIT, LLC


Wesley Vogel said:
First, I do not use or know anything about Terminal Server.

Why not use HKEY_LOCAL_MACHINE? This affects all users on a machine.

[HKEY_LOCAL_MACHINE \Software\Microsoft\Terminal Server
Client\Default\AddIns\RDPDR]
"FilterQueueType"=dword:ffffffff

I am the only user on my machine, so I only have
HKEY_USERS\S-1-5-21-1708537768-1580436667-1202660629-1003

But anything changed in the HKEY_USERS\SID # key is also changed in the
HKEY_CURRENT_USER when that user is logged on and vice versa.

HKEY_USERS\SID # for each user\Software\Microsoft\Terminal Server
Client\Default\AddIns\RDPDR
"FilterQueueType"=dword:ffffffff

Are you referrencing one of these?

Printers That Use Ports That Do Not Begin With COM, LPT, or USB Are Not
Redirected in a Remote Desktop or Terminal Services Session
http://support.microsoft.com/default.aspx?scid=kb;en-us;q302361

Remote Desktop Connection software may cause an access violation if
FilterQueueType is set
http://support.microsoft.com/?kbid=329756

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
Hal Berenson said:
I forgot to include the .reg. It is:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Terminal Server
Client\Default\AddIns\RDPDR]
"FilterQueueType"=dword:ffffffff


--
Hal Berenson, President
PredictableIT, LLC


Hal Berenson said:
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?
 
It's based on

Printers That Use Ports That Do Not Begin With COM, LPT, or USB Are Not
Redirected in a Remote Desktop or Terminal Services Session
http://support.microsoft.com/default.aspx?scid=kb;en-us;q302361

Will using HKLM in this case really work? My experience to date says that
unless placing a particular key in either HKLM or HKCU is explicitly said to
work then it does not work. As for dealing with multiple users on a machine
via HKU\sid, that seems like a relatively difficult thing to automate.
Also, are each of these hives always loaded or are they only loaded when the
user logs in?

--
Hal Berenson, President
PredictableIT, LLC


Wesley Vogel said:
First, I do not use or know anything about Terminal Server.

Why not use HKEY_LOCAL_MACHINE? This affects all users on a machine.

[HKEY_LOCAL_MACHINE \Software\Microsoft\Terminal Server
Client\Default\AddIns\RDPDR]
"FilterQueueType"=dword:ffffffff

I am the only user on my machine, so I only have
HKEY_USERS\S-1-5-21-1708537768-1580436667-1202660629-1003

But anything changed in the HKEY_USERS\SID # key is also changed in the
HKEY_CURRENT_USER when that user is logged on and vice versa.

HKEY_USERS\SID # for each user\Software\Microsoft\Terminal Server
Client\Default\AddIns\RDPDR
"FilterQueueType"=dword:ffffffff

Are you referrencing one of these?

Printers That Use Ports That Do Not Begin With COM, LPT, or USB Are Not
Redirected in a Remote Desktop or Terminal Services Session
http://support.microsoft.com/default.aspx?scid=kb;en-us;q302361

Remote Desktop Connection software may cause an access violation if
FilterQueueType is set
http://support.microsoft.com/?kbid=329756

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
Hal Berenson said:
I forgot to include the .reg. It is:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Terminal Server
Client\Default\AddIns\RDPDR]
"FilterQueueType"=dword:ffffffff


--
Hal Berenson, President
PredictableIT, LLC


Hal Berenson said:
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?
 
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
 
Hi

Personally, I think the best way of doing it would depend on his setup,
but he never clarified it.
 
Back
Top