This post has been migrated from www.experimentsincode.com, we apologise if some of the images or content is missing

Razl Script Mode is coming in the next release of Razl which will allow you to automate the process of pulling content between Sitecore instances. For those not familiar with Razl it is a tool that allows you to compare two Sitecore instances and move item and field changes from one instance to the other. Razl Script mode allows you to define a series of task in XML format that should be performed by Razl, these tasks can then be executed from the command line or as part of a build. This makes the following tasks very easy:
  • After deploying the latest changes code and item changes to a staging environment you can easily grab the latest content from your live environment and pull this back into staging as part of the build. The staging environment will then contain the latest code and content by just kick off a build and the whole process is full automated.
  • During deployment to live you might setup parallel CMS boxes, one that has the new changes on it and one that is being used by the content editors. While your development team deploy the changes to the new environment the content editing team can continue to update content on the older environment. Once the new environment is ready to go your developers can run a Razl script to copy the latest changes from the old environment to the new environment. This minimises the amount of down time that your content editors experience.
Launching into Razl script mode is very easy, from the command prompt you just need to add the /script attribute and specify the path to the XML file that you want to run:
The syntax for the XML file is very simple, first we need to define our connections:
<razl>
	<connection name="qa" install="true">
		<url>http://razl-qa</url>
		<accessGuid>C63C521E-A912-4EB4-82F0-78F553CE3EF5</accessGuid>
		<database>master</database>
		<path>c:\sitecore\razl-qa\website</path>
	</connection>
</razl>
You can define as many connections as you like in the XML file, so one XML file can copy content between multiple servers. You can also instruct the script to install the connector on the target instance if you want. On live boxes it is better to install the Razl connector using the package installation mode in the Razl GUI, otherwise the live box would recycle every time you ran the script, a connection to live might look like this:
	<connection name="live" readOnly ="true">
		<url>http://Razl-LIVE</url>
		<accessGuid>C63C521E-A912-4EB4-82F0-78F553CE3EF5</accessGuid>
		<database>master</database>
	</connection>
With our connections configured we can define the operations we want to perform, the following are support by script mode:
  • CopyAll - copy an entire tree of items
  • CopyHistory - copy changes recorded in the Sitecore History engine
  • CopyItem - copy a single item
Lets look at the CopyHistory operation:
<operation name="CopyHistory" source="live" target="qa">
	<parameter name="from">2</parameter>
</operation>
This will instruct Razl to copy all changes from live to qa within the last 2 days. Of course we can also specify this as a date and give a to date:
<operation name="CopyHistory" source="live" target="qa">
	<parameter name="from">2014-01-01T00:00:00</parameter>
	<parameter name="to">2</parameter>
</operation>
This will copy everything from the start of the year until 2 days ago. When running the script Razl gives you lots of information about the tasks it is performing so that changes should be easy to audit: If you combine this new feature with Team Development for Sitecore you can have a fully automated deployment that will deploy the latest code and then pull the latest content onto an environment without any developer interaction.