[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Script/Tool to modify config files

Posted on 2011-10-21
9
Medium Priority
?
947 Views
Last Modified: 2012-05-12
Hi All

the scenarios is we have 100+ Servers.
I am looking for a script/Tool that would help me in updating config files, like maching.config or web.config or any other config file on the servers.

Example:
At times we need to modify a tag in machine.config. So this tool should ask for Search/Replace kind of thing where I will provide with multiple current tags in machine.config and will also provide new tags that I want to be replaced by the old one.

Also, it should provide with option to add new tag under some parent tag. Ie I will mention that I need to add new tag and then provide the name of parent tag under which I want the new tag to be added.

So, two things as of now

1) Ability to update existing tag
2) Ability to add new tag under some parent tag

Please let me know if you need any further clarification.

Thanks in advance
0
Comment
Question by:ghelaniabhishek
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 59

Expert Comment

by:Bill Prew
ID: 37008171
Are the config files all in the same format?  And can you post a sample of what that format is?

~bp
0
 

Author Comment

by:ghelaniabhishek
ID: 37026993
lets consider the file to be machine.config
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 37080356
Can you supply the informsation that Bill asked for so we can look?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 59

Expert Comment

by:Bill Prew
ID: 37080466
I'm a bit leery to propose a generic updater for these files.  I believe they are basically well formed XML files, and as such a pure text search and replace approach could lead to errors in the xml structure in the file.  

A proper approach likely needs to work with the file as a true xml document.  One approach to this is via PowerShell as in:

http://geekswithblogs.net/nharrison/archive/2011/05/25/updating-the-machine.config--with-powershell.aspx

But I'm not really a PowerShell expert, so things like the prompting and such you want would be better handled by someone else.

You might also look at the tool based technique in this artical for additional thought:

http://learn.iis.net/page.aspx/578/package-an-application-for-the-windows-web-application-gallery/

~bp
0
 

Author Comment

by:ghelaniabhishek
ID: 37080677
Thanks for the reply bill.
Yes, these are all XML based config file.  A simple search and replace tool would also work for me if you have anything available.

two things the tool needs to do is

1) Add new tag
2) replace existing tag

while adding new tag, you need to ask for the parent tag, ie the new tag should be added within which tag

and while replacing existing tag, you can simply provide a search and replace kind of thing where we provide the entire code, you search for it and replace with the new one
0
 
LVL 43

Accepted Solution

by:
Steve Knight earned 1000 total points
ID: 37081374
Agreed with you here Bill.  Powershell not got enough attention here yet for me either and updating in batch while possible is tricky with all those < > and the like in there.  VBScript easier but feels like pre-inventing the wheel.

Is Powershell an option here, will suggest it gets added as a zone for you.

Meanwhile this sounded like it might be useful though having looked more it is out of date and not suitable:
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=21714

I haven't tried it yet but JExamXML sounds promising here:
http://www.a7soft.com/download.html

So end of the line for anything I can do easily on this one, will see if Powershell people have a two liner for you!

0
 
LVL 12

Assisted Solution

by:JESii
JESii earned 1000 total points
ID: 37086524
I believe Chef does it all - see http://wiki.opscode.com/display/chef/Home. Open source; highly configurable and customizable.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses
Course of the Month18 days, 8 hours left to enroll

825 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