Sitecore PowerShell Update

The Sitecore PowerShell Update module is especially handy when you've been tasked with applying changes to items in bulk.

Remove all Japanese items that were last modified by the Anonymous user more than 100 days


cd master:/sitecore/content/Home/Course-Listing/Tutorials

get-childitem -Language "ja-JP" -recurse `
| where-object { $_.__Updated -lt [datetime]::Now.AddDays(-100) } `
| where-object { $_."__Updated By" -eq "sitecore\Anonymous" } ` 
| Remove-ItemLanguage -Language "ja-JP"

Update field values


Get-ChildItem -Recurse . | Where-Object { $_.Name -eq "Speakers"  } | ForEach-Object { 
     
    $originalName = $_.Name
    $newName = "Faculty"
     
    Write-Host "Renaming item from " -nonewline;
    Write-Host $originalName -f Yellow -nonewline;
    Write-Host " to " -nonewline;
    Write-Host $newName -f Green;
     
    $_.Editing.BeginEdit()
    $_.Name = $newName;
    $_.Fields["Navigation Title"].Value = $newName;
    $_.Fields["Headline"].Value = $newName;
    $_.Fields["Meta Keywords"].Value = $newName;
    $_.Fields["Meta Description"].Value = $newName;
    $_.Editing.EndEdit()
     
    ""
}