Saturday, December 4, 2010

Deploy Registry Updates to Multiple Computers

Challenge:

You need to modify a specific registry key or value on 50, 500 or 5,000 computers on your network.  You need to get it done in the next 15 minutes.  Your boss is standing over you with a can of pepper spray and a taser.  The HR manager has a pink slip ready, the name is not yet filled out.  They are tapping their fingers and breathing heavily.  The pressure is on. …


Solution 1: Use REG.exe and a script

Solution 1 - Steps:

  1. Create a list (text file) containing the names of computers (ex. "computers.txt")
  2. Create a script to read the text file list, and run REG ADD <params> on each computer
  3. Open CMD and run the script

Example Script for Solution 1:

@echo off
FOR /F "tokens=1 delims=," %%G IN (computers.txt) DO (
    @echo %%G
    reg add \\%%G\HKLM\Software\Test /v Vname /d 123 /t REG_SZ /f
)


Solution 2: Use PsExec.exe in a script with a script

Solution 2 - Steps:

  1. Create a list (text file) containing the names of computers (ex. "computers.txt")
  2. Export the registry data from a reference computer (ex. "regdata.reg")
  3. Open CMD and run the following (example code only):

    psexec @computers.txt reg import \\server\share\regdata.reg

No comments: