We help IT Professionals succeed at work.

Registry changes Via batch files

1,039 Views
Last Modified: 2014-08-12
Hi,

I have to make the below change on 100 machines in a phased method.

Is there a way I can change the following registry entires via a batch file?

2007: HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\AutoDiscover
"PreferLocalXML"=dword:1
"ExcludeHttpRedirect"=dword:0
"ExcludeHttpsAutodiscoverDomain"=dword:1
"ExcludeHttpsRootDomain"=dword:1
"ExcludeScpLookup"=dword:1
"ExcludeSrvLookup"=dword:1
"ExcludeSrvRecord"=dword:1

Thanks.
Comment
Watch Question

Commented:
Hey,

You can create a .vbs file (not quite sure if this will work with a bat file) and add the following lines. And so on and so forth, you get the idea i guess.. :)

REG.exe ADD HKCU\Software\Microsoft\Office\12.0\Outlook\AutoDiscover /v PreferLocalXML /d 1 /f
REG.exe ADD HKCU\Software\Microsoft\Office\12.0\Outlook\AutoDiscover /v ExcludeHttpRedirect /d 1 /f
Thomas GrassiSystems Administrator

Commented:
You can try this

 @ECHO OFF
 CLS
REGEDIT.EXE /S  yourfilename.reg
EXIT


Create yourfilename.reg with
2007: HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\AutoDiscover
 "PreferLocalXML"=dword:1
 "ExcludeHttpRedirect"=dword:0
 "ExcludeHttpsAutodiscoverDomain"=dword:1
 "ExcludeHttpsRootDomain"=dword:1
 "ExcludeScpLookup"=dword:1
 "ExcludeSrvLookup"=dword:1
 "ExcludeSrvRecord"=dword:1

as its contents
Net Admin
Top Expert 2012
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT

Commented:
You could always use Group Policy if the machines are on a domain
CERTIFIED EXPERT

Commented:
cumbersome but short answer

A list of all the computers in a file computers.txt

then run the below commands:

for /f %a in (computers.txt) do REG ADD "\\%a\HKCU\Software\Microsoft\Office\12.0\Outlook\AutoDiscover" /V "PreferLocalXML" /T dword /D 1 /F
for /f %a in (computers.txt) do REG ADD "\\%a\HKCU\Software\Microsoft\Office\12.0\Outlook\AutoDiscover" /V "ExcludeHttpRedirect" /T dword /D 0 /F
for /f %a in (computers.txt) do REG ADD "\\%a\HKCU\Software\Microsoft\Office\12.0\Outlook\AutoDiscover" /V "ExcludeHttpsAutodiscoverDomain"  /T dword /D 1 /F
for /f %a in (computers.txt) do REG ADD "\\%a\HKCU\Software\Microsoft\Office\12.0\Outlook\AutoDiscover" /V "ExcludeHttpsRootDomain"  /T dword /D 1 /F
for /f %a in (computers.txt) do REG ADD "\\%a\HKCU\Software\Microsoft\Office\12.0\Outlook\AutoDiscover" /V "ExcludeScpLookup"  /T dword /D 1 /F
for /f %a in (computers.txt) do REG ADD "\\%a\HKCU\Software\Microsoft\Office\12.0\Outlook\AutoDiscover" /V "ExcludeSrvLookup"  /T dword /D 1 /F
for /f %a in (computers.txt) do REG ADD "\\%a\HKCU\Software\Microsoft\Office\12.0\Outlook\AutoDiscover" /V "ExcludeSrvRecord"  /T dword /D 1 /F

Open in new window

Author

Commented:
Hi,

Thanks for the responses. I would like to have a batch file I can just double click on each machine to run. Therefore would creating a file with the below for each value I need to change be the best way?

Would this overwrite any existing registry entries?

REG ADD "HKCU\Software\Microsoft\Office\12.0\Outlook\AutoDiscover" /V "PreferLocalXML" /T dword /D 1 /F

Commented:
Hey,

Yes you would need a batch file with all those rules and yes, it will overwrite all existing entries because of the /f (which means force) so it suppresses a message when the key already exists.

You can off course remove the /f but that would mean clicking a lot
CERTIFIED EXPERT

Commented:
Why would you want to do this locally via clicking on a batch file ?


First problem I see with that approach is the sheer consumption of time.
Second issue, you will have "users" clicking on bat files (which they can read in notepad etc if they feel inquisitive) to make registry changes ?


I think you are better off managing via gpo or scripting out from a central location.
Thomas GrassiSystems Administrator

Commented:
He can also just add it to the login script then the users do not need to click on it.
CERTIFIED EXPERT

Commented:
Anything that removes the option of a user clicking on a batch file gets my vote, I just think it is a bad path to go down.

Author

Commented:
Hi,

We are doing a migration to a hosted mail provider who requests that we make these changes to every users machine.

As we are doing this in a phased method by department we will need to run this as we are ready to re-configure the users email each time, running this as a batch file each time will greatly speed up the process.

Thanks for the responses. Is there anything additional i need to put into the script?

The users dont have admin rights so I assume i will have to run with elevated permissions.

Commented:
Hey,

First off i do agree with some of the comments that there are better ways to do this but i think it is still up to the original poster on how he (or she) wants do have something done. If you want to do it manually (though heavy time consuming) than please feel free to do so.

Second of, problem is these are user settings so no, don't run them with elevated privileges, this would mean using another account and then these settings will be placed in the HKCU of that other account. So just fire it of with the user being affected logged in.

Also do keep in mind that, if you don't have roaming profiles, you will need to do this for all and every local profile a user has on any machine.

Author

Commented:
Thanks for all your help. Gabriel's solution works best for us.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.