Deploy .reg script to the domain

What's the best way to deploy a reg file to the domain?  Can I just stick it into the \\domainname\sysvol ?  Would that work?
LVL 17
Tiras25Asked:
Who is Participating?
 
comnutsCommented:
Nope, renaming from .reg to .bat/.cmd won't work. You will need to keep that .reg file and use the command regedt32.exe /s "filename.reg" in order to merge the registry file into reg. Therefore you will have 2 files, one is the batch and the other is the .reg.

Sample Batch without checking if key exists
====================================
@echo off
regedt32.exe /s "\\MyFileServer1\Registry\Registry.reg"
0
 
comnutsCommented:
I don't think placing it there will work out of the box, moreover it will probably be applied continuously.

I would suggest to write a batch file and insert it into a group policy's Scripts (Startup/Shutdown) or Scripts (Logon/Logoff) depending on your needs. This will provide the elevated privileges and you can have the batch file to do the following:

1. Detect if the registry key already exists (VBS or Batch depending on needs)

Ref: http://www.daniweb.com/software-development/legacy-languages/threads/61011/check-if-registry-key-exists-in-batch-file or http://blogs.technet.com/b/heyscriptingguy/archive/2004/10/29/how-can-i-tell-whether-a-value-exists-in-the-registry.aspx

2. Apply registry file with /s option if not exists

Ref: http://support.microsoft.com/kb/310516

Once the batch file is tested, add it into group policy and apply to the computers that need it. (http://support.microsoft.com/kb/198642)
0
 
achaldaveCommented:
Or you can use group policy preferences to deploy registry settings
http://technet.microsoft.com/en-us/library/cc771001.aspx
0
WEBINAR: 10 Easy Ways to Lose a Password

Join us on June 27th at 8 am PDT to learn about the methods that hackers use to lift real, working credentials from even the most security-savvy employees. We'll cover the importance of multi-factor authentication and how these solutions can better protect your business!

 
Tiras25Author Commented:
Hi guys, so to deploy via the Group Policy it only takes one key path.  My .reg has more than one.  
As for the bat file.  Renaming from .reg to .bat would that work?
0
 
Tiras25Author Commented:
Got it.  So if I stick that bat file into the \\domainname\sysvol that would apply anytime anyone login to the servers?
0
 
comnutsCommented:
There is this video that will go thru GPO for scripts to run at logon.

2:15 onwards - http://www.youtube.com/watch?v=ap7uM0yiEkY

I would probably put the batch file on the file share and browse to it on the GPO.

There are other ways to do this too, which involves the Show Files button where you can copy and paste the batch and reg file so that it will replicate to other domain controllers. Using this, you just need to type the batch filename instead of browse.

Remember to test it out in a test environment.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.