Skip to content

Instantly share code, notes, and snippets.

@AlexKasaku
Created August 21, 2015 10:15
Show Gist options
  • Save AlexKasaku/073fab1fd001eadc0fe9 to your computer and use it in GitHub Desktop.
Save AlexKasaku/073fab1fd001eadc0fe9 to your computer and use it in GitHub Desktop.
Update a bunch of items to edit a field
<#
.SYNOPSIS
Updates a field in a set of items
#>
$items = Get-ChildItem -Recurse | Where TemplateName -eq "Redirect Url"
foreach( $item in $items ) {
if ($item."Requested Url".StartsWith("/sitecore") ) {
$newUrl = $item."Requested Url" -replace "/sitecore/admin/sitecore/content/xxx/home",""
Write-Host $item."Requested Url"
$item."Requested Url" = $newUrl
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment