Last month I took part in the Hackathon organized by SDL in San Francisco. It was a great event and had the chance to meet with the most brilliant minds when it comes to SDL products...
As part of the event we (Warner Soditus and I, here is our team page The Tappers!) came up with an idea that I am glad to announce has materialized into DTAP!
Our vision (or at least the starting point) on how to enahnce the DTAP capabilities of SDL Tridion.
If you want to jump directly to the code here is the repository:
The content that follows is available as a word document in such repository too, but you can continue reading here to get a better understanding on what this solutions is about. Enjoy!
What is DTAP-It?
What do you do when you want to export content from one Tridion environment to another?What do you do when you want to copy Groups from one Tridion environment to another?What do you do when you need to copy a bunch of Folders or Structure Groups with complex ACL from one Tridion environment to another?
You DTAP-It!
DTAP-It is a powerful Tridion GUI extension which will allow you to select items and move them to another Tridion environment using Content Porter directly from the UI. On top of that it will allow you to select Groups, Folders and Structure Groups to move permissions from one environment to another.
Setup
Since you have already unzipped DTAP.zip, you should see several directories. There are several elements to configure.
PowerShell Modules
Note: This step is only necessary if you are planning to call the scripts from the command line using the PowerShell console.* The UI eXtension will add those itself when running from the UI.
Place the modules directory your desired location. For example, assume this location is: C:\tridion\modules
Now, you must edit your PowerShell module path to include the above directory and load the included modules. You can choose one of two ways to do this. You can edit the profile for your specific user or the profile for all users. The easiest way is to execute one of the following:
All users (if first file is not found, use the second):
notepad $PsHome\Microsoft.PowerShell_profile.ps1
notepad $PsHome\Profile.ps1
Current User:
notepad $Profile
Somewhere in the file, add the below lines:
$curPSModulePath = Get-Content Env:\PSModulePath
$env:PSModulePath = $curPSModulePath + ";C:\tridion\modules"
Import-Module Tridion-API -force
Import-Module Tridion-DTAP -force
Core Service Connections
There is a directory included named "settings." Note where you have placed this directory. For example, assume this location is: C:\tridion\settings.
Edit the file:
notepad C:\tridion\modules\Tridion-API\CoreServiceSettings.psm1
Look for this line:
$coreserviceSettingPath = "D:\opt\apps\scripts\powershell\settings\coreservice"
Modify to match the settings directory location you noted earlier.
$coreserviceSettingPath = "C:\tridion\settings\coreservice"
Save and close the file.
Server Details
Note: This step is only necessary if you are planning to call the scripst from the command line using PowerShell console.* The UI eXtension will add those itself when running from the UI.
Duplicate the example.xml in the settings\coreservice directory to an appropriate name (e.g. "dev.xml," "qa.xml," "prod.xml") and edit. Below is an example with highlights to show what should likely be modified. If you are not using Tridion 2013 SP1 you will want to change the DLL specification to match your version.
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04">
<Obj RefId="0">
<TN RefId="0">
<T>Deserialized.System.Object</T>
</TN>
<ToString>System.Object</ToString>
<MS>
<Version N="ModuleVersion">1.0.0</Version>
<S N="Version">2013SP1</S>
<S N="AssemblyPath">[your module path]\modules\Tridion-API\Clients\Tridion.ContentManager.CoreService.Client.2013sp1.dll</S>
<S N="ClassName">Tridion.ContentManager.CoreService.Client.SessionAwareCoreServiceClient</S>
<S N="ConnectionType">netTcp</S>
<S N="HostName">myhost</S>
<S N="CME">http://myhost</S>
<S N="EndpointUrl">net.tcp://myhost:2660/CoreService/2013/netTcp</S>
<S N="SendTimeout">00:10:00</S>
<S N="ReceiveTimeout">00:10:00</S>
<S N="CloseTimeout">00:10:00</S>
<S N="SendTimeout">00:10:00</S>
<S N="MaxReceivedMessageSize">2147483647</S>
<S N="MaxStringContentLength">2147483647</S>
<S N="MaxArrayLength">2147483647</S>
<S N="MaxBytesPerRead">2147483647</S>
<S N="MaxItemsInObjectGraph">2147483647</S>
</MS>
</Obj>
</Objs>
Test Your Connections
Open a new PowerShell window. Execute the following with each of the settings files you specified:
Import-TridionCoreServiceSettings -ServerName "[setting name]"
For example:
Import-TridionCoreServiceSettings -ServerName "dev"
Then execute:
Get-TridionUser
You should see information regarding your Tridion User. If you experience any error, then things are not configured correctly ☺
Repeat with each settings file you created and ensure you can connect to each Core Service host.
Import-TridionCoreServiceSettings -ServerName "qa"
Get-TridionUser
Import-TridionCoreServiceSettings -ServerName "prod"
Get-TridionUser
GUI Extension
Note: in this step we assume you have unzipped the DTA.zip file into a folder within the server where SDL Tridion is running.
Ensure you are logged onto the server as an administrator. Locate the gui_install.ps1 file. Right-click and select "Run with PowerShell"
Follow all instructions. The script will prompt you for:
- The Tridion Home directory
- A directory to hold the GUI Extension files
- CME URL
- Tridion IIS Site Name
The script will copy the following DLL files to the [Tridion Home]\web\WebUI\WebRoot\bin directory.
- Tridion.Extensions.UI.DTAP.Base.dll
- Tridion.Extensions.UI.DTAP.Editor.dll
- Tridion.Extensions.UI.DTAP.Model.dll
Note that it will alert you if you are missing any of the dependent DLL files in your [Tridion Home]\web\WebUI\WebRoot\bin directory.
- ChilkatDotNet4.dll
- Tridion.ContentManager.ImportExport.Client.dll
- Tridion.ContentManager.CoreService.Client.dll
- Tridion.ContentManager.ImportExport.Common.dll
- System.Management.Automation.dll
The script will create two IIS virtual directories, each named DTAP, one under Editors and one under Models. The System.Config file will be updated with the editor/model specification. Also the [Tridion_Home]\web\WebUI\WebRoot\Web.config file will be updated with the CME host you specified.
The script will also restart IIS for you.
You should clear your browser cache before proceeding.
Getting Started
This UI eXtension allows you to move items across environments, so in order to do that you need to configure such environments. This is a very simple process
Click on the DTAP Page in the Ribbon Toolbar and then Click on Configuration
This will show the Configuration dialog:
Configuration is publication specific, so in order to be able to save different environments, you need to select a publication from the top dropdown and then click on add:
Note: this dialog behaves similarly to the Session Preview sites URL in the Publication Target Editor.
Enter a value in the following format and hit save when done (you can add multiple servers at once):
NAME – http://hostname:port
To remove an entry, select the entry to delete and click on "Remove"
To edit an entry, select the entry to modify and hit "Edit", Then you can modify the value.
To add another entry, repeat the first step.
To add another entry, repeat the first step.
Note: The eXtension uses the 'hyphen' character (-) to determine the server url, so you can potentially enter any name before the hyphen, but you must ensure that the part after the hyphen is a valid url.
HERE YOU CAN TYPE ANYTHING - http://127.0.0.1
Once the servers are configured, the system will use the browser url as the source server to move items from. So you need to be in the "source" server to move items to "another" environment
In this example I am going to use two environments QA (http://localhost) and PROD (http://sdltridion.pe.local). I will be moving things from QA to DEV
As explained before, I need to start on the "Source" server (localhost):
There are two tasks that you can perform using the eXtension:
Content Porting
In order to enable this task, you need to start from a selection in the CMS, you can select a component, multiple components, a folder, a bundle, etc… You can start the tool from a virtual folder as well as from a search result too. Simply select several items and click the "DTAP-It" option:
Select the target environment (Defined in the configuration section). Test the connection.
If the connection is successful you can now run Content Porter. The feedback from the service will be displayed in the progress window area:
Permissions Porting
From this same dialog you can port permissions too. Simply click on the "Organizational Items" tab or the "Groups" tab to select which items you want to move (including their ACLs)
Once the items are selected simply click the "Port Permissions" button. The process will start. 
Be patient, wait for the confirmation in the progress area.
Disclaimer: If the process fails stating that access is denied for user 'DOMAIN\USER' as follows:
Make sure you create that user in both environments, source and target, and make it and administrator:
Once that is done, the error should go away:
If you want to simply "Port Permissions" there is no need to select anything in the CMS. You just need to click the DTAP-It command button and you'll get the DTAP dialog without the content porter option.
Command Line Execution for Folders, Structure Groups, and Groups
If you do not want/need to use the GUI extension to help you migrate Folders, Structure Groups, and Groups from one environment to another, you can do so via the PowerShell command line. This section shows you how.
Build Export List
First, connect to your source machine in a PowerShell window.
Import-TridionCoreServiceSettings -ServerName "dev"
Next, build up an array of assets. You can specify either TCM IDs or WebDavUrls.
$assets = @()
$assets += (Get-TridionGroup -GroupName "Group 1").Id
$assets += (Get-TridionGroup -GroupName "Group 2").Id
$assets += "\TS070 Public Site\Home\pages"
$assets += "\C020 Shared Global Content US English\Building Blocks\Content\HTML Block"
$assets += "\TC040 Local Public Content US English\Building Blocks\Content\test"
Export Assets
To perform the export, execute the following cmdlet. Make sure to specify an appropriate directory for the output files. You can add a Verbose flag if desired.
Export-TridionDTAPAssets `
-TcmIdOrWebDavUrls $assets `
-Recursive `
-Directory "C:\tridion\modules\output\dtap"
Import Assets
First, connect to your destination server.
Import-TridionCoreServiceSettings -ServerName "qa"
To perform the import, execute the following cmdlet. Make sure to specify an appropriate directory for the files previously output. You can add a Verbose flag if desired.
Import-TridionDTAPAssets `
-Directory "C:\tridion\modules\output\dtap"
Maintenance
The tool creates several temporary files in these locations:
- INSTALL PATH\DTAP.Model\PowerShell\output\dtap
- INSTALL PATH\DTAP.Model\PowerShell\settings\coreservice
You can delete the files on those folders EXCEPT sample.xml under DTAP.Model\PowerShell\settings\coreservice
Supported SDL Tridion Version
SDL TRIDION 2013 SP1
Add a comment