Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC settings with vbscript

Status
Not open for further replies.

jundalabee

IS-IT--Management
Nov 19, 2003
35
Hi,
I know very little about vbscripts, but I was wondering if it is possible to write a script that once it was run would delete an odbc entry, and then add a new one on any local machine.

Or could the odbc changes be made even easier by using a simple batch file??

Anyway, any help would be muchly appreciated.
 
Or could the odbc changes be made even easier by using a simple batch file
A .reg file should do the trick.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
registry is the way to go, you will need to manip it sometrhing like this
dim wsh : set wsh = wscript.createObject( "WScript.Shell" )
const ODBC = "HKLM\SOFTWARE\ODBC\ODBC.INI\"


sub createODBC( sName, sServer, sDesc, sDatabase, sUser )
dim ODBCS
ODBCS = ODBC & sName & "\"
wsh.regWrite ODBC, sName
wsh.regWrite ODBC & "ODBC Data Sources\" & sName, "SQL Server"
wsh.regWrite ODBCS & "Driver", "C:\WINNT\System32\sqlsrv32.dll"
wsh.regWrite ODBCS & "Description", sDesc
wsh.regWrite ODBCS & "Server", sServer
wsh.regWrite ODBCS & "Database", sDatabase
wsh.regWrite ODBCS & "LastUser", sUser
wsh.regWrite ODBCS & "UseProcForPrepare", "0"
end sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top