Location: List Archives

List Archives

This forum is an archive of all posts to our mailing list over the past few years.  The forum is set read only therefore to contribute you will need to join our list community.  See more info about this here.

List Archives

Subject: [ActiveDir] DSN(No, this is not a typo!)
Prev Next
You are not authorized to post a reply.

AuthorMessages
mmapplebeck@xxxx.yyy

08/25/2005 12:44 PM  
Hi everyone, I am having a problem here, and Google wants to keep asking me
if I mean DNS and screws up my search. I need to install a DSN for an SQL
server on all machines in my domain, but I am not aware of an easy way to do
this i.e. GPO. Is there a script out there to install a data source on many
machines? Any help would be appreciated. - Marc

List info : http://www.activedir.org/List.aspx
List FAQ : http://www.activedir.org/ListFAQ.aspx
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/
aaron_visser@xxxx.yyy

08/25/2005 1:25 AM  
This might help you out, got it off of:

http://www.experts-exchange.com/Databases/Q_21032275.html

The best way to deploy your new DSN is to create a GPO and apply it to the
Active Directory OU for workstations. This GPO will release the registry
export (ie .reg) at the next boot of your clients.

You'll find the DSN informations in your registry (Start -> Run -> regedit)
at :

HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI for a system DSN
HKEY_CURRENT_USER (or HKEY_USERS\{user SID}) \SOFTWARE\ODBC\ODBC.INI for a
user one

Simply export the key and create the GPO, and AD will deploy it for you.

Again not sure about this just got it from the site above

Aaron
On 8/24/05 5:43 PM, "Marc A. Mapplebeck" wrote:

> Hi everyone, I am having a problem here, and Google wants to keep asking me
> if I mean DNS and screws up my search. I need to install a DSN for an SQL
> server on all machines in my domain, but I am not aware of an easy way to do
> this i.e. GPO. Is there a script out there to install a data source on many
> machines? Any help would be appreciated. - Marc
>
> List info : http://www.activedir.org/List.aspx
> List FAQ : http://www.activedir.org/ListFAQ.aspx
> List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/
List info : http://www.activedir.org/List.aspx
List FAQ : http://www.activedir.org/ListFAQ.aspx
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/
TonyTestUser is Offline

Posts:0

08/25/2005 12:55 PM  
Is this script any good to you?

http://www.databasejournal.com/features/mssql/article.php/2238221

Tony

-----Original Message-----
From: ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Marc A.
Mapplebeck
Sent: Thursday, 25 August 2005 12:43 p.m.
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: [ActiveDir] DSN(No, this is not a typo!)

Hi everyone, I am having a problem here, and Google wants to keep asking
me if I mean DNS and screws up my search. I need to install a DSN for an
SQL server on all machines in my domain, but I am not aware of an easy
way to do this i.e. GPO. Is there a script out there to install a data
source on many machines? Any help would be appreciated. - Marc

List info : http://www.activedir.org/List.aspx
List FAQ : http://www.activedir.org/ListFAQ.aspx
List archive:
http://www.mail-archive.com/activedir%40mail.activedir.org/

########################################################################
####
This e-mail message has been scanned for Viruses and Content and cleared
by NetIQ MailMarshal at Gen-i Limited
########################################################################
####

List info : http://www.activedir.org/List.aspx
List FAQ : http://www.activedir.org/ListFAQ.aspx
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/
jfountain@xxxx.yyy

08/25/2005 12:58 PM  
This works for me.  I put the machines I need to add the DSN in a txt file and it connects to each machine via remote registry (so you need to be an admin of the box for this to work).

HTH
Jenn

-----Original Message-----
From:   ActiveDir-owner@xxxxxxxxxxxxxxxxxx on behalf of Marc A. Mapplebeck
Sent:   Wed 8/24/2005 8:43 PM
To:     ActiveDir@xxxxxxxxxxxxxxxxxx
Cc:    
Subject:        [ActiveDir] DSN(No, this is not a typo!)
Hi everyone, I am having a problem here, and Google wants to keep asking me
if I mean DNS and screws up my search. I need to install a DSN for an SQL
server on all machines in my domain, but I am not aware of an easy way to do
this i.e. GPO. Is there a script out there to install a data source on many
machines? Any help would be appreciated. - Marc

List info   : http://www.activedir.org/List.aspx
List FAQ    : http://www.activedir.org/ListFAQ.aspx
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/
*********************************************************************************
The information transmitted is intended only for the person or entity to which
it is addressed and may contain confidential and/or privileged material. Any
review, retransmission, dissemination or other use of, or taking of any action
in reliance upon, this information by persons or entities other than the intended
recipient is prohibited. If you received this in error, please contact the sender
and delete the material from any computer

Option Explicit
'Constants
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003
Const HKEY_CURRENT_CONFIG = &H80000005

'Variables
On Error resume next
Dim DataSourceName
Dim DatabaseName
Dim Description
Dim DriverPath
Dim LastUser
Dim Server
Dim Trusted_connection
Dim DriverName
Dim InputFile
Dim iFSO
Dim ifile
Dim sComputer
Dim sPath

'Value assignment

DataSourceName = "Name"
DatabaseName = "Name"
DriverPath = "%WINDIR%\System32\sqlsrv32.dll"
LastUser="sa"
Server="sqlserver"
Trusted_connection="Yes"
Description="ODBC DSN for the Database: " & DatabaseName
DriverName="SQL Server"
InputFile="C:\pclist.txt"
Set iFSO = CreateObject("Scripting.FilesyStemObject")
Set ifile = iFSO.OpenTextFile(inputfile)
sPath = "SOFTWARE\ODBC\ODBC.INI\" & DataSourceName

'Read and loop through the input file
Do until ifile.AtEndOfLine
sComputer = ifile.ReadLine
If (0 = CreateRegKey(sComputer, HKEY_LOCAL_MACHINE, sPath)) Then
SetRegKeyStrValue sComputer, HKEY_LOCAL_MACHINE, sPath, "Database", DatabaseName
SetRegKeyStrValue sComputer, HKEY_LOCAL_MACHINE, sPath, "Description", Description
SetRegKeyStrValue sComputer, HKEY_LOCAL_MACHINE, sPath, "Driver", DriverPath
SetRegKeyStrValue sComputer, HKEY_LOCAL_MACHINE, sPath, "LastUser",LastUser
SetRegKeyStrValue sComputer, HKEY_LOCAL_MACHINE, sPath, "Server",Server
SetRegKeyStrValue sComputer, HKEY_LOCAL_MACHINE, sPath, "Trusted_Connection",Trusted_connection
Else
Exit Do
End If
'Write in "ODBC Data Sources" Key to allow ODBC Manager list & manage the new DSN
SetRegKeyStrValue sComputer, HKEY_LOCAL_MACHINE, "SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources", DataSourceName , DriverName
Wscript.Echo (sComputer & " DONE!")
Loop
ifile.Close
Set ifile = Nothing
Set iFSO = Nothing

'Create RegKey Function

Function CreateRegKey (sComputer, hTree, sKey)
Dim oRegistry
Dim lResult
Set oRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}//" & sComputer & "/root/default:StdRegProv")
lResult = oRegistry.CreateKey(hTree, sPath)
If (lResult = 0) And (Err.Number = 0) Then
CreateRegKey = 0
Else
CreateRegKey = 1
Wscript.Echo("Create Key " & sKey & " Failed")
End If
Set oRegistry = Nothing
End Function

'set RegKey Function

Function SetRegKeyStrValue (sComputer, hTree, sKey, sValueName, sValue)
Dim oRegistry
Dim lResult
Set oRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}//" & sComputer & "/root/default:StdRegProv")
lResult = oRegistry.SetStringValue(hTree, sKey, sValueName, sValue)
If (lResult = 0) And (Err.Number = 0) Then
SetRegKeyStrValue = 0
Else
SetRegKeyStrValue = 1
Wscript.Echo("Set Value for " & sKey & " Failed")
End If
Set oRegistry = Nothing
End Function
You are not authorized to post a reply.
Forums >ActiveDir Mail List Archive >List Archives > [ActiveDir] DSN(No, this is not a typo!)



ActiveForums 3.7
AdventNet Banner
Friends

Friends

Namescape
Members

Members

MembershipMembership:
Latest New UserLatest:jonrmeyer
New TodayNew Today:7
New YesterdayNew Yesterday:0
User CountOverall:4279

People OnlinePeople Online:
VisitorsVisitors:104
MembersMembers:0
TotalTotal:104

Online NowOnline Now:

Ads

Copyright 2008 ActiveDir.org
Terms Of Use