I am trying to execute this script but it is throwing an error.
$path = "/sitecore/content/home"
$root = Get-Item $path
$items = Get-ChildItem $path -Recurse
($items += $root) | Where-Object { $_.TemplateName -eq "Product" -or $_.TemplateName -eq "Accessory" } | ForEach-Object {
Write-Log "Hi"
}
This part is throwing an error: ($items += $root)
.
Error:
Failed to call the method because [Sitecore.Data.Items.Item] does not contain a method named "op_Addition"