Last active
September 24, 2022 08:33
-
-
Save agehlot/423929eea587b448fed413c7c5e60bef to your computer and use it in GitHub Desktop.
Sitecore PowerShell script to recursively reset the base template of all items under given path.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-ChildItem "/sitecore/templates/Feature/Fortune" -Recurse |% { | |
$currentTemplate = $_ | |
$templateIds |% { | |
$currentTemplate."__Base Template" = $currentTemplate."__Base Template" -Replace "$($.ID)|", "" | |
$currentTemplate."__Base Template" = $currentTemplate."__Base Template" -Replace "$($.ID)", "" | |
} | |
} | |
$templateIds |% { | |
$deletingTemplate = $_ | |
Get-ChildItem "/sitecore/content" -Recurse | ? { $_.TemplateName -eq $deletingTemplate.Name } | Remove-Item | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment