Jump to content

ODBC System DSN


Recommended Posts

I have recently started using Autoit. i have been creating logon scripts for the users of our servers i creadted a logon script that opens outlook and adds a new Exchange account but of course if they have loged on before it will just open Outlook

Run("C:\Program Files\Microsoft Office\OFFICE11\outlook.exe")

WinWaitActive("Outlook 2003 Startup")

Send("!N")

Send("!N")

Send("!M")

Send("!N")

Send("!E")

Send("Exchange")

Send("!U")

Send(@Username)

Send("!N")

Send("{Enter}")

This isnt my main focus but any help on how to run all these scripts once on the first time the user logs into the PC would be helpful. My main question comes from a program i am going to automate an install for from the server the program uses an SQL database and i have in the past been adding the SQL in the ODBC System DSN => add new SQL is there anyway to get the script to do that i have tries alot of ways to get ODBC to run

Run("C:\Documents and Settings\All Users\Start Menu\Programs\Administrative Tools\Data Sources (ODBC).lnk")

Run("odbccp32.cpl")

these work if you type it into run on start menu but the ODBC doesnt open in the script any clues to why it wont open or a better way too add the SQL Server

Link to comment
Share on other sites

I have recently started using Autoit. i have been creating logon scripts for the users of our servers i creadted a logon script that opens outlook and adds a new Exchange account but of course if they have loged on before it will just open Outlook

Run("C:\Program Files\Microsoft Office\OFFICE11\outlook.exe")

WinWaitActive("Outlook 2003 Startup")

Send("!N")

Send("!N")

Send("!M")

Send("!N")

Send("!E")

Send("Exchange")

Send("!U")

Send(@Username)

Send("!N")

Send("{Enter}")

This isnt my main focus but any help on how to run all these scripts once on the first time the user logs into the PC would be helpful. My main question comes from a program i am going to automate an install for from the server the program uses an SQL database and i have in the past been adding the SQL in the ODBC System DSN => add new SQL is there anyway to get the script to do that i have tries alot of ways to get ODBC to run

Run("C:\Documents and Settings\All Users\Start Menu\Programs\Administrative Tools\Data Sources (ODBC).lnk")

Run("odbccp32.cpl")

these work if you type it into run on start menu but the ODBC doesnt open in the script any clues to why it wont open or a better way too add the SQL Server

Always try to find a command line utility to perform everything, as you'll always eventually run into issues using keyboard and/or mouse commands (especially with a logon script - users are great at interrupting scripts at the perfect time to bomb them out).

To automate Outlook profile creation use the Custom Maintenance Wizard (from Office Resource Kit): http://office.microsoft.com/en-us/ork2003/...1402831033.aspx

To automate ODBC connections try manipulating this example (the example is for myodbc): http://forums.devshed.com/showpost.php?p=1...amp;postcount=9

Also, your Run() commands aren't working, because you can't perform a Run() on a shortcut, nor can you use "run" commands without modifying the Run() function input like so:

Run(@ComSpec & " /c odbccp32.cpl") ; this will run the command from the command line
Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt
Link to comment
Share on other sites

The cpl is the way to go, but if you really need to run a shortcut, this should work.

Run(@comspec & " /c " & 'cd "c:\Documents and Settings\All Users\Start Menu\Programs\Administrative Tools" && ".\Data Sources (ODBC).lnk"',"",@SW_HIDE)
Link to comment
Share on other sites

My main question comes from a program i am going to automate an install for from the server the program uses an SQL database and i have in the past been adding the SQL in the ODBC System DSN => add new SQL is there anyway to get the script to do that i have tries alot of ways to get ODBC to run

Run("C:\Documents and Settings\All Users\Start Menu\Programs\Administrative Tools\Data Sources (ODBC).lnk")

Run("odbccp32.cpl")

these work if you type it into run on start menu but the ODBC doesnt open in the script any clues to why it wont open or a better way too add the SQL Server

The end result of adding an ODBC System DSN is only some registry entries.

You can avoid to GUI completely and write the registry entries at: HKLM\SOFTWARE\ODBC\ODBC.INI\New_DSN_Name

The driver should be listed in: HKLM\SOFTWARE\ODBC\ODBCINST.INI\Driver_Name

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Well the information has helped me to deploy the System DSN to the user and at the moment i have been writing ideas down for a bigger version of my script as i have been scripting my first one i have been getting many ideas and reading lots of the help file and other forum posts that have been giving me ideas for a more efficient script that may interest some Server administrators that want to automate installations. the script hasn't been started its in the stage of information and data gathering to work an effective way to get my recent ideas into play so you will be hearing more on this new script if i need any feedback or help or if any of you are interested i can jot my ideas down on here and get feedback and basically brainstorm with a few people to get this script into motion

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...