Tuesday, September 22, 2015

Sitecore 8: Toggle CD Configuration Files Powershell Script

As part of Sitecore's official Configuring a CD Server, there are several configuration files and dlls that need to be disabled. This can get tedious to do if you are setting up several CD servers, or if you ever need to revert back to a CM configuration.

This powershell script should make this less time consuming: CDConfiguration.ps1

The script has 3 parameters when you run it...

  1. The folder path of your Sitecore instance's \Website (Ex: "D:\Sitecore\Dev-CD-SC8\Website\")
  2. If you are configuring a CM or a CD server.
  3. If you are using Lucene or Solr index configurations.
It will crawl through your \Include folder, and toggle the configuration files listed in the URL above. 

There are also 2 specific behaviors of the script to be aware of...
  1. It will move your SwitchMasterToWeb to a folder \zzzMustBeLast. Read more here as to the reasons why.
  2. If the configuration file exists in both an enabled and disabled state (ie: files xxx.config and xxx.config.disabled both exist), running the script with the CD parameter will assume the enabled is the most recent, and will overwrite the disabled file.
This script is useful for when you already have an instance setup and you just need to toggle the configuration files back and forth.

If you are setting up a brand new CD server, go check out Patrick Perrone's post for a PowerShell Sitecore Install Script to automate the entire process.

No comments:

Post a Comment