The code available below might help you tweak the DSN update through a script. Do the following steps
- Save the new updated DSN settings
- Create a BAT file. Example mentioned below
- Run the BAT file to update the registry settings
This comes in handy when you are looking to updates many user desktops.
Here is the example:
cls
echo off
cls
- Create directory for backup
if not exist c:\temp\DSN\nul md c:\temp\DSN
- Backup host file
if not exist c:\temp\DSN\hosts copy %windir%\system32\drivers\etc\hosts c:\temp\DSN\hosts
- Backup registry settings
if not exist c:\temp\DSN\DSN_restore.reg regedit /e c:\temp\DSN\DSN_restore.reg "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI"
- Copy new Host file
Copy C:\NewRegFiles\hosts %windir%\system32\drivers\etc\hosts
- Add registry settings
regedit.exe /s C:\NewRegFiles\Newregistrysettings.reg
No comments:
Post a Comment