A typical Web Experience Management (WEM, formerly CQ5) solution deployment involves the Apache HTTP Server as a load-balancer as well as a caching proxy for the “publish” instance(s). Configuration is typically spread across multiple configuration files, in addition to the main one (httpd.conf). These include dispatcher.any, the config file for the WEM Dispatcher.
If you needed to make small changes (like replacing the host name, or port), you have to do this in multiple files and in multiple locations within each file.
The script captures input from the user on what to replace and what to replace it with, stops the Apache Windows service, backs up the original files, edits them, saves them, and starts the Apache Windows service.
Obviously, you will need to edit the script before running it in your environment. PowerShell is Windows’ preferred scripting environment. Both Windows 7 and Windows Server 2008 come with the Windows PowerShell ISE (Integrated Scripting Environment). You can use this IDE to edit the script.