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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setting up ODBC connections in login script 1

Status
Not open for further replies.

Blinken

MIS
Jul 7, 2003
19
0
0
US
Is there a way to set up ODBC connections in the login script? Right now i have registry entries that i can double click on to install for system DSN's but now i need to do it on a per user basis while connecting to terminal servers.
 
You can either launch regedit with the Run method of the WScript.Shell object or play with the RegWrite method.

Hope This Help
PH.
 

Try this sub... You may need to play around with the Driver path.

dim wsh : set wsh = wscript.createObject( "WScript.Shell" )
const ODBC = "HKLM\SOFTWARE\ODBC\ODBC.INI\"

'----------------------------------------------------
'# Create an ODBC datasource.
'# 31/7/2001 - SJD
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

 
sounds like you are goingfor some sort of hybrid profile, or a mandatory profile for a user. perhaps terminal services can do this for you? if not PHV suggestion is what you are after. we do something similar with a user hybrid profile. each user or user group or location can import or export registry keys and values based on an ini file listing the keys and values to import/export.

u r best off starting with a mandatory reg import i would say based via the methods already suggested
 
you can have a star from me! might come in handy during our off2000 to off2003 migration

thanks
richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top