You get a bonus - 1 coin for daily activity. Now you have 1 coin

Windows: how to change the registry on several computers at once

Practice



Task: there is a certain registry key value that needs to be set on several computers. At the same time, using group policies for this is out of scope for this note.


1) Create a computers.txt file (you can name it whatever you like).

2) Into this file put the IP addresses of the computers or their network names - one per line.

3) Create a bat file with the following contents:
FOR /F "Tokens=*" %%A IN (computers.txt) DO reg.exe ADD "\\%%A\HKLM\Software\MySoftware" /v MyKeyName /d REG_DWORD /v 1 /f

Here:
  • computers.txt : The file we created
  • ADD : Command for the REG.EXE console registry management utility
  • "\\..." : Path to the desired registry key. The %%A variable will hold the computer name for each line of the computers.txt file
  • /v MyKeyName : Name of the registry key
  • /d REG_WORD : Type of the registry key
  • /v 1 : Value assigned to this key
  • /f : Don't prompt for confirmation to overwrite existing values


.


PS. If you're running this command ("FOR...") from the command line (not from a bat file), replace %%A with %A.

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Operating Systems and System Programming"

Terms: Operating Systems and System Programming