How to Reset All SP 2010 Site Pages to Default Definitions with PowerShell

I couldn’t get this to work for me (maybe I was having a thick day) so I asked Colin to devise a way that worked in my situation).  If you need to whack your SharePoint 2010 on the head with a big bat and make it forget all the customizations that have been perform on page and site definitions, then this is the script for you.
Replace the part with your root site collection and Execute from the SharePoint-enabled PowerShell command line:

$site = Get-SPSite "" 
$sites = @(foreach ($web in $site.AllWebs) { 
$web | Select-Object -Property Url
Write-Debug "Resetting all pages in site ($($web.Url))..."
}) | out-File -filepath "c:Output.txt" 

.csharpcode, .csharpcode pre
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
background-color: #f4f4f4;
width: 100%;
margin: 0em;
.csharpcode .lnum { color: #606060; }

It will also output a list of the webs that were bonked to the file c:Output.txt.

Hoping the above helps someone, when they absolutely need to hard reset to definition, particularly in an ugly/adopted site collection migration scenario. (I won’t go into the gory details of the one I had the pleasure of doing)