Import .reg using a GPO
Hi, I want update some registry keys in 20 computers in my Domain (Windows 2003). I've an idea about how to do it but I have a problem with the key I want to import. The .reg I want to import is similar to this: [HKEY_USERS\S-1-5-21-1614886498-1084647444-620655208-2865\Printers] "DeviceOld"="HP LaserJet 2300L Informatica,winspool,Ne04:" I would like to import a .reg like this in several users. Is there some variable to change automatically the user Sid, like %username% in Windows, in the registry? Thanks a lot.
December 2nd, 2010 8:35am

Are you running the registry script at the useraccount itself? (i.e. at userlogon?) Then you could use something like: [HKEY_CURRENT_USER\Printers] "DeviceOld"="HP LaserJet 2300L Informatica,winspool,Ne04:"
Free Windows Admin Tool Kit Click here and download it now
December 2nd, 2010 8:46am

Are you running the registry script at the useraccount itself? (i.e. at userlogon?) Then you could use something like: [HKEY_CURRENT_USER\Printers] "DeviceOld"="HP LaserJet 2300L Informatica,winspool,Ne04:" IT WORKS !!!! Thanks a lot Freek
December 2nd, 2010 9:46am

Hello Tronik The awnser given by Freek is correct and, as you say, it works. This way, you import the values on the registry user branch of the logged in user when the reg file is imported. If you want to import such keys and values to all profiles of the users that have previously logged in on the computer, and on the profiles of future users, you can use the following method: Put the code below on a file with .cmd extension and run it as an administrator; you can do it with an script using the pstools psexec command, as in the following line: psexec -i -s c:\path\myscript.cmd The .cmd file must have the following code, obviously adapted to your needs: for /f "tokens=1,2* delims=\" %%i in (' reg query HKU ') do reg add HKU\%%j\Test /f for /f "tokens=1,2* delims=\" %%i in (' reg query HKU ') do reg add HKU\%%j\Test /v example /t REG_DWORD /d 100 /f The first line looks over all the keys under HKEY_USERS, filling the %%j variable with the name of every user profile key, and then creates a new subkey named "test". The second line does the same, and creates into the Test subkey a new DWORD value named "example" and fills it with number "100" /f parameter does the script not asking to replace keys or values if they exist. You can downdoad the sysinternals psexec command from the next link, and you have to copy the file to the Windows folder or another one listed in the path variable of the computers before launching the script. If you launch the file in interactive mode on a Windows Vista / 7 /2008 client you can do it running the script with elevated privileges (run as administrator) instead of using psexec. http://technet.microsoft.com/es-es/sysinternals/bb897553.aspx This code works, but you must do all your tests on a test computer that you can reinstall without problems if you make an error on the code. The REG command allows you to change almost everithing on the registry, and executed with the psexec -s program you give it local system permissions on the computer; you must be sure that it performas just as you want before to distribute it on all the computers in your domain. Saludos José Antonio Quílez Mi Blog
Free Windows Admin Tool Kit Click here and download it now
December 9th, 2010 10:54am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics