i want to change the item template in all language version and retain the data. I have tried this :

$rootItem = Get-Item master:"/sitecore/content/home/"
$sourceTemplate = Get-Item "{E6787535-1C98-4C18-9D45-68DF4837BEF8}";
$targetTemplate = Get-Item "{CB1DACB2-0B85-4D92-9BC7-5EC0CF208E5F}";


Get-ChildItem $rootItem.FullPath -recurse | Where-Object { $_.TemplateName -eq $sourceTemplate.Name } | ForEach-Object {
    Set-ItemTemplate -Item $_ -TemplateItem $targetTemplate `
        -FieldsToCopy @{'Module ID'="AccordionModuleId" ;'Module Category' = "AccordionModuleCategory"; 'Module Title' = "AccordionModuleTitle"; 'Items' = "AccordionModuleLinks" }

But it works fine only for en language and for rest of the languages it is having empty field values. Any way of achieving this?

  • At the following link you can see the documentation lists that the Language and Version parameters can be used. doc.sitecorepowershell.com/… Aug 28 '20 at 13:32
  • I am also facing the same issue, any way to achieve this?
    – Kishore
    May 18 at 1:24

I did something in the past for updating all templates, and got through by using this within my loop :

$masterDatabase = [Sitecore.Configuration.Factory]::GetDatabase("master");

your loop and conditions {

$actualTemplate = $master.Templates["Path/To/YourTemplate"];


Hope it helps, cheers !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.