Clicky

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

asked 10/21/2011 12:05

ghelaniabhishek's gravatar image

ghelaniabhishek ♦♦


7 Answers:
Are the config files all in the same format?  And can you post a sample of what that format is?

~bp
link

answered

billprew's gravatar image

billprew

lets consider the file to be machine.config
link

answered 2011-10-21 at 11:24:51

ghelaniabhishek's gravatar image

ghelaniabhishek

Can you supply the informsation that Bill asked for so we can look?
link

answered 2011-10-25 at 12:26:58

dragon-it's gravatar image

dragon-it

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
link

answered 2011-11-03 at 17:08:00

billprew's gravatar image

billprew

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
link

answered 2011-11-03 at 17:56:27

ghelaniabhishek's gravatar image

ghelaniabhishek

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!

link

answered 2011-11-03 at 19:08:49

dragon-it's gravatar image

dragon-it

I believe Chef does it all - see http://wiki.opscode.com/display/chef/Home. Open source; highly configurable and customizable.
link

answered 2011-11-04 at 00:23:59

JESii's gravatar image

JESii

Your answer
[hide preview]

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×33

Asked: 10/21/2011 12:05

Seen: 211 times

Last updated: 12/11/2011 06:08