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.

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?



billprew's gravatar image


lets consider the file to be machine.config

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

ghelaniabhishek's gravatar image


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

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

dragon-it's gravatar image


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:

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:


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

billprew's gravatar image


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

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

ghelaniabhishek's gravatar image


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:

I haven't tried it yet but JExamXML sounds promising here:

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!


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

dragon-it's gravatar image


I believe Chef does it all - see Open source; highly configurable and customizable.

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

JESii's gravatar image


Your answer
[hide preview]

Follow this question

By Email:

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



Answers and Comments



Asked: 10/21/2011 12:05

Seen: 211 times

Last updated: 12/11/2011 06:08