Changing templates on items with search and powershell
I recently had an issue where a deployment change had released several items to production where newly created content folders were of the wrong template type. We discovered it late, so there were many of these improper items scattered throughout the content tree. Luckily we have Sitecore PowerShell Extensions to the solve the problem.
Because the site is large, crawling from /Sitecore/Content down would take forever. To get around that, I used Find-Item function to query the sitecore index for what I am looking for.
Thew results from Find-Item are of type, Sitecore.ContentSearch.SearchType.SearchResultItem. So we need to create a new Item with
$item = Get-Item $id. Then use the inherited class of ChangeTemplate to change the template,