Opret DSN ODBC connection med VBS
Hej EksperterJeg har et problem med at få password med over med et script, som opretter en system DSN under ODBC datakilder. Er der nogen som kan fortælle mig hvad jeg mangler for at få password med?
***************************
' createDSN.vbs
Dim DataSourceName
Dim DatabaseName
Dim Description
Dim DriverPath
Dim DriverName
Dim LastUser
Dim Regional
Dim Server
Const SystemFolder= 1
Dim fso
Dim SysFolder
Dim SysFolderPath
Set fso = wscript.CreateObject("Scripting.FileSystemObject")
Set SysFolder =fso.GetSpecialFolder(SystemFolder)
SysFolderPath= SysFolder.Path
'Specify the DSN parameters.
DataSourceName = "DSN NAVN"
DatabaseName = "DB NAVN"
Description = "Odbc for " & DatabaseName
DriverPath = SysFolderPath & "\sqlsrv32.dll"
Server = "SQL SERVER NAVN"
LastUser ="BRUGERNAVN"
Password ="PASSWORD"
DriverName = "SQL Server"
Set WshShell = WScript.CreateObject("WScript.Shell")
Dim RegEdPath
RegEdPath= "HKLM\SOFTWARE\ODBC\ODBC.INI\" & DataSourceName & "\"
WshShell.RegWrite RegEdPath , ""
WshShell.RegWrite RegEdPath & "Database" , DatabaseName
WshShell.RegWrite RegEdPath & "Description" , Description
WshShell.RegWrite RegEdPath & "Driver" , DriverPath
WshShell.RegWrite RegEdPath & "LastUser" , LastUser
WshShell.RegWrite RegEdPath & "Password" , Password
WshShell.RegWrite RegEdPath & "Server" , Server
WshShell.RegWrite "HKLM\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources\" & DataSourceName , DriverName
wscript.echo "Done!"
wscript.Quit
**************