Set objshe = WScript.CreateObject("WScript.Shell")
a="HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\sql01\Driver"
d=regwri(a,"%windir%\system32\SQLSRV32.dll","REG_SZ")
a="HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\sql01\Description"
d=regwri(a,"sql01","REG_SZ")
a="HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\sql01\Server"
d=regwri(a,"sql.corp.stas.local","REG_SZ")
a="HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\sql01\UID"
d=regwri(a,usenam,"REG_SZ")
a="HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\sql01\Trusted_Connection"
d=regwri(a,"Yes","REG_SZ")
'=== créer un path sans valeur "\" at end, c = "" (type)
a="HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\sql01\Engines\"
d=regwri(a,"","")
a="HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\ODBC Data Sources\sql01"
d=regwri(a,"SQL server","REG_SZ")
'====== write a value in registry, trap error
function regwri(regkey, value, type01)
if type01<>"" then
on error resume next
objshe.RegWrite regkey,value,type01
else
objshe.RegWrite regkey,""
end if
if err.number<>0 then
'msgfin = msgfin & "`n" & regkey & "`n"
toterrcop = toterrcop + 1
msgfin03 = msgfin03 & vbcrlf & "error - register base not written: " & vbcrlf & regkey & vbcrlf & err.description & vbcrlf
if usenam = debugname then
'msgbox("cannot write key" & vbcrlf & regkey & vbcrlf & value)
end if
end if
end function
|