This post would help you to change the template of some items programatically with Sitecore Powershellscript to a new template. It would actually change the templateId of the item using Powershellscript.
This post gives details on what renderings are in Sitecore and different types of renderings available in Sitecore. This post also helps you to understand the concept of Layout and Placeholders in Sitecore
This PowerShell script can be used to clean or list all the Sitecore media library items which are not referenced by any item in Sitecore. This can also be restricted to a sub tree within the media library by updating the source path accordingly.