Solved

URGENT!!!  How do I modify a sql.ini file with a script to add another SQL server to the list?

Posted on 2006-06-27
4
1,102 Views
Last Modified: 2009-12-16
I must have this file modified within 2 days for all users!.....URGENT!

I need to have our SQL.ini file modified for all users who access our internal application.
Each user has the following ini file:

The file is located on each users' XP machine here:
C:\Documents and Settings\%username%\Application Data\(App Name)

[win32client.dll]
comdll=sqlodb32
[win32client]
clientname=XP(user name here)
[odbcrtr]
remotedbname=(server name here),DSN=(Application here) (server name here)

We need to add another line to the end of the file as listed:
remotedbname=(new server name),DSN=(app name here) (new server name here)





0
Comment
Question by:stvbrx
4 Comments
 
LVL 5

Assisted Solution

by:WmOfTewks
WmOfTewks earned 250 total points
ID: 16992639
Any number of scripting languages can do this; VB, VBScript, Kixstart, AutoIt, this list goes on.  The key, of course, is to get this into the group policy so that it runs on everyone's system.  That's where I fall short.

However, I am an AutoIt (http://www.autoitscript.com/autoit3/) afficianado and the script (briefly) would be:
IniWrite("path_to_SQL.ini", "odbcrtr", "remotedbname", "(new server name),DSN=(app name here) (new server name here)" )

AutoIt can be compiled to an EXE for running anywhere.

Good luck.
0
 
LVL 28

Accepted Solution

by:
Michael Pfister earned 250 total points
ID: 16992671
Do you have some kind of login script in place? If its a command line script you can add these lines

@echo off
SET SQLINI=%userprofile%\Application Data\(App Name)\SQL.INI
findstr /I (new server name) "%SQLINI%"
If errorlevel 1 goto :AddLine
Goto :EOF
:AddLine
Echo remotedbname=(new server name),DSN=(app name here) (new server name here)>>"%SQLINI%"
Goto :EOF

You probably have to tweak it a bit to fit into your script.
0
 
LVL 30

Expert Comment

by:callrs
ID: 16994151
Below is a two-line Quick Macros (www.quickmacros.com) script  I use
 - Sets "MinPagingFileSize=1000000" in [386Enh] section of system.ini:

str f="C:\windows\system.ini"
rset 1 "ConservativeSwapfileUsage" "386Enh" f

-----
 You can simply add a line to the very end of a file too. E.g. in your case:

str myuser myclient myapp f addThis
myuser=getenv("username"); myapp="Some App"; myclient.from("XP" myuser)
f.format("C:\Documents and Settings\%s\Application Data\%s\SQL.ini" myuser myapp)

addThis.format("[]remotedbname=%s, DSN=%s %s" "(new server name)" "(app name)" "(new server name)")
addThis.setfile(f -1);  mes _s.format("%s   added to %s" addThis f)

0
 

Author Comment

by:stvbrx
ID: 16995334
Thanks for the quick response WmOfTewks and mpfister!

You two were very quick to help and within minutes of each other....so I'll split points.
(This was my first post, so I do hope this is in order here.)

It looks like mpfister is probably the best suited for my situation since it can be applied directly to my logon script.

thanks to all!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In a recent article here at Experts Exchange (http://www.experts-exchange.com/articles/18880/PaperPort-14-in-Windows-10-A-First-Look.html), I discussed my nine-month sandbox testing of the Windows 10 Technical Preview, specifically with respect to r…
In this article we will discuss all things related to StageFright bug, the most vulnerable bug of android devices.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now