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

Changing DNS (for 64 bit machine) Settings via VBScript

Status
Not open for further replies.
May 5, 2004
29
GB
Hi There,

I was looking for a way to be able to manipulate the registry
on Windows 7 64 bit machine via vbscript.

The below code works fine on a 32 bit machine running XP Pro

I understand that the following reference:
REG_KEY_PATH = "HKLM64\SOFTWARE\Wow6432Node\ODBC\ODBC.INI\XXX"
or
REG_KEY_PATH = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBC.INI\XXX"
might be needed, but don't know how to get it to work.

...nevertheless I can't see what's in the "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBC.INI\XXX"
registry location. Is there tweaking to the code to actually see what's in there?

BTW lResult is always null, should have the name of the reg entry.

Many Thanks people

Andrew

--------------------------------------------------------------

On Error Resume Next

Dim RegObj
Dim SysEnv

Set RegObj = WScript.CreateObject("WScript.Shell")

'***** Specify the DSN parameters *****

DataSourceName = "XYZ_NoddyDataMart"
DatabaseName = "NoddyDataMart"
Description = "NoddyDataMart"
LastUser = ""
Server = "XYZ"

'if you use SQL Server the driver name would be "SQL Server"
DriverName = "SQL Server"

'Set this to True if Windows Authentication is used
'else set to False or comment out
WindowsAuthentication = True

'point to DSN in registry
REG_KEY_PATH = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBC.INI\XXX"

' Open the DSN key and check for Server entry
lResult = RegObj.RegRead (REG_KEY_PATH & "\Server")

'if lResult is nothing, DSN does not exist; create it
if lResult = "" then...........
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top