jan-h
9/29/2016 - 8:50 AM

Synchronize SDL Web components with schemas using PowerShell

Synchronize SDL Web components with schemas using PowerShell

#WARNING this script is set to run component-sync with the -Update flag, meaning it will commit and save the changed components

#Usage examples
# .\item-sync-publications.ps1
# .\item-sync-publications.ps1 | Tee-Object sync.log

# Prerequisite: Install the tridion-powershell-modules https://github.com/pkjaer/tridion-powershell-modules

Import-Module Tridion-CoreService -Verbose:$false
Set-TridionCoreServiceSettings -Version "2013-SP1"

$publications = Get-TridionPublications | Where-Object {!$_.Title.StartsWith("_")} | Where-Object {!$_.Title.Contains("Test")}
ForEach ($pub in $publications) {
    Write-Output ("Syncing publication {0} {1}" -f $pub.Id, $pub.Title)
    .\item-sync.ps1 $pub.Id -Update
    Write-Output "" 
}
Write-Output ""
Write-Output "Done!"