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,155 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 29

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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just about everyone has an old PC laying around.  Ask anyone in the IT industry, whether they are a professional or play in it as a hobby.  From outdated Desktops to cheap "throwaway" laptops, they are all around and not as hard to "fix up" as you m…
#Citrix #POC #XenDesktop #vCenter #VMware #ESX
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Suggested Courses

617 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