How to Set a Registry Entry on Multple Computers?

by [Published on 20 May 2010 / Last Updated on 30 July 2009]

This article explains how you can use FOR loop to set a registry entry on computers specified in a text file.

This article explains how you can use the FOR loop to set registry entry on multiple computers. As an example, you want to enable SFCScan on all computers on your network. This is how you accomplish this:

  1. Create a text file called Comps.TXT
  2. Put all the computer names in it.
  3. Next run the following command from a command window:

FOR /F "Tokens=*" %A IN (Comps.TXT) DO REG.EXE Add "\\%A\HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon /v SFCScan /d REG_DWORD /v 1 /F

The above command runs on all the computers mentioned in the Comps.TXT file and execute the REG.EXE command against each computer mentioned in the Comps.TXT file.


See Also

The Author — Nirmal Sharma

Nirmal Sharma avatar

Nirmal Sharma is a MCSEx3, MCITP and was awarded the Microsoft MVP award in Directory Services and Windows Networking. He specializes in Microsoft Azure, Office 365, Directory Services, Failover Clusters, Hyper-V, PowerShell Scripting and System Center products. Nirmal has been involved with Microsoft Technologies since 1994. In his spare time, he likes to help others and share some of his knowledge by writing tips and articles on various sites and contributing to PowerShell-based Dynamic Packs for www.ITDynamicPacks.Net solutions.

Featured Links