Syncing Windows registry between several computers
Sorry for taking so long, I think this is the longest I have taken to write an answer!
Ages ago, I wanted very similar functionality, but, I could not find a way of doing it... now that I know quite a bit more programming, I thought it would be worth a try to make something.
So, a few hours later, I give you, RegSync v1
.
Simply take a copy of the full registry path (in your case HKEY_CURRENT_USER\Software\SimonTatham\PuTTY
) and paste it in to the box.
Click start and it will automatically monitor that registry key for any additions, deletions or changes.
If it detects any changes, it will*
export a registry file called regsync.reg
in the same folder as the application is running.
*
In case of more than one change at a time, it will wait for 5 seconds after the first change.
When/after the start button is pressed, it will monitor the folder it is in for any changes to the regsync.reg
file, and if it detects a change, it will delete ALL entries in the registry key you selected locally and import the registry file. (Please be careful, it will not check the .Reg
file matches the location it is monitoring, so, if you type different locations on each pc, it may go bad).
So... you can run this from dropbox or windows shares, or any other folder sharing service. Run it on both computers and select the registry key to monitor.
Extra notes...
This requires the .NET framework version 4.
It does not monitor subkeys, you can run additional copies of the tool though in different folders (I already have ideas to improve this, but, only if people have a need for the tool).
Whilst it does not require UAC elevation, it will bug you for elevation every time it tries to import or export from the registry (It basically calls
regedit.exe
/reg.exe
), so, I recommend that you run the program elevated... It does this several times and it will become very annoying.No guarantees - It gets the "Works on my PC" badge, and I have tested it across a few machines, but, this has not had code review and hours of testing... Start to finish in a few hours.
Even if you do not end up using it, I hope it is useful to someone out there!
Download Link
it might be easier to run regedit.exe in silent mode with a registry file that contains the exact entries you want. You can set each computer to run it from a shared location so all you need to do is update the file and when the next scheduled run of regedit.exe runs on each computer, they get the new entries.
something like:
regedit.exe /S puttyentries.reg
In order to pull a registry key from one computer, you would use:
regedit.exe /E puttyentries.reg "registry_key"
There would probably be more elegant ways of automating the whole process using vbscript or autoit with remote read/write functions for the registry.
Here is an example with AutoIt that will sync every 30 minutes with a remote computer (caveat, I really haven't tested this):
While 1 ;loop indefinitely
$i1 = 1 ;set initial counter
While 1 ;loops through all sessions
$keyname = RegEnumVal("\\REMOTECOMPUTER\HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions", $i1) ;reads session names
If @error <> 0 Then ExitLoop ;exits when no more sessions exist
$i2 = 1 ;set initial counter
While 1 ;loops through all value in key until done
$valuename = RegEnumVal("\\REMOTECOMPUTER\HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions" & "\" & $keyname, $i2) ;read value name from remote machine
If @error <> 0 Then ExitLoop ;errors and escapes when no more values to read
$type = @extended ;sets registry value type
$value = RegRead("HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Session" & "\" & $keyname, $valuename) ;read value
RegWrite("HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Session" & "\" & $keyname, $valuename, $type, $value) ;write key value to local machine
$i2 = $i2 + 1 ;increment by 1
WEnd
$i1 = $i1 + 1 ;increment by 1
WEnd
Sleep(1800000) ;sleep 30 min
WEnd