Find all list templates used in a website


Scenario:
You need to determine the template used to create a list (or a library).

PowerShell script:

$web = get-spweb http://site:port/web
$web.lists | Format-Table -Property Title, BaseType, BaseTemplate -auto

Note:
The above script will list all BaseTypes and BaseTemplates used in the web

Export MOSS 2007 feature to *.wsp file

Scenario:
You need to extract an existing feature from MOSS 2007 into a *.wsp file to install it on another server (for example)

PowerShell script:

[System.Reflection.Assembly]::Load(“Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”)
[System.Reflection.Assembly]::Load(“Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”)
$farm = [microsoft.sharepoint.administration.spfarm]::Local
$feature = "solutionname.wsp"
$wsp = $farm.Solutions.Item($feature.SolutionFile)
$wsp.SaveAs("c:\$feature")

Note:
If you need to install PowerShell (Installation does not require a restart) you can download it from here: http://support.microsoft.com/kb/968930

Props:
The solution originally provided here: extract wsp file from configuration database

FIX: The site is not valid. The 'Pages' document library is missing

Scenario:
Trying to create a new page fails with this error:

Microsoft.SharePoint.Publishing.InvalidPublishingWebException: The site is not valid. The 'Pages' document library is missing.    
at Microsoft.SharePoint.Publishing.PublishingWeb.GetPublishingListWithCleanup(PublishingListType list, Boolean throwExceptionOnInvalidWeb)     
at Microsoft.SharePoint.Publishing.Internal.CodeBehind.BasePageSettingsPage.get_PageListRoot()     
at Microsoft.SharePoint.Publishing.Internal.CodeBehind.BasePageSettingsPage.SetParentUrlLabel()   
at Microsoft.SharePoint.Publishing.Internal.CodeBehind.BasePageSettingsPage.LoadValues()     
at Microsoft.SharePoint.Publishing.Internal.CodeBehind.CreatePagePage.LoadValues()     
at Microsoft.SharePoint.Publishing.Internal.CodeBehind.BasePageSettingsPage.OnLoad(EventArgs e)     
at Microsoft.SharePoint.Publishing.Internal.CodeBehind.CreatePagePage.OnLoad(EventArgs e)     
at System.Web.UI.Control.LoadRecursive()     
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Fix: runt this PowerShell script:
$web = get-spweb http://site:port/web
$newId = $web.Lists["Pages"].ID
$web.AllProperties["__PagesListId"] = $newId.ToString()
$web.Update()