I'm new to Sitecore PowerShell and would like to know the best way to get all the items on my content tree that have a specific rendering parameter set so I can replace it with another value in the rendering parameter. I know I can replace the layout IDs but I thought of using PowerShell to create a more elegant solution.
I reviewed the documentation on Get-Rendering and Set-Rendering but couldn't get the script to work. Here is what I have so far. Any help is highly appreciated
$defaultLayout = Get-LayoutDevice "Default"
$path = "master:\sitecore\content\home\page-that-has-rendering"
$language = 'en-US'
$items = Get-ChildItem -Path $path -Language $language -Recurse
$newValue = Get-Item -Path 'master:\sitecore\content\home\path-to-mynewrenderingparametervalue'
$items | ForEach-Object {
$rendering = Get-Rendering -Id $_.ID -Device $defaultLayout -FinalLayout
#$param = Get-RenderingParameter -Rendering $rendering | Format-Table -Auto
foreach($itemRendering in Get-Rendering -Item $_ -FinalLayout) {
$parameters = Get-RenderingParameter -Rendering $itemRendering
Set-Rendering -Instance $newValue
}
}
$newValue
? Is that another item that you're copying the rendering parameters from?