If you ever needed to just see which content types are being utilized on your SharePoint 2007/2010 Site you can grab these content types using Power Shell.
Since SharePoint (MOSS) 2007 does not already come pre-installed with Windows PowerShell 2.0 you will have to download a copy and install it onto your WFE you can grab it here- http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=20430
For SharePoint 2010 PowerShell comes installed so you would just open up the SharePoint 2010 Management Shell.
After installing Windows PowerShell below is the script that can be used to grab all Content Types on a specific Site in SharePoint 2007.
—————————————————————————————————————————————————-
1. Open up Windows PowerShell 2.0 with Admin rights.
2. Next Type:
#Load the SharePoint 2007 Assemblies. This is needed for Windows PowerShell to communicate with SharePoint
[System.Reflection.Assembly]::Load(“Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral,PublicKeyToken=71e9bce111e942c”) | out-null
$siteUrl=”http://portal/site”
$site=new-object Microsoft.SharePoint.SPSite($siteurl)
$web=$site.RootWeb
foreach($ctype in $web.ContentTypes)
{$ctype.Name}
—————————————————————————————————————————————————–
If you are searching for a specific content type you can use this.
—————————————————————————————————————————————————–
#Load the SharePoint 2007 Assemblies. This is needed for Windows PowerShell to communicate with
SharePoint[System.Reflection.Assembly]::Load(“Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral,PublicKeyToken=71e9bce111e942c”) | out-null
$siteUrl=”http://portal/site”
$site=new-object Microsoft.SharePoint.SPSite($siteurl)
$webs = $site.AllWebs
foreach($web in $webs)
{
foreach($lst in $web.lists)
{
foreach($item in $lst.Items)
{
if ($item.ContentType.Name -like “*<name of contenttype>*)
{Write-Host $web.Url “-” $item.ContentType.Name “-” $item.Url}
}
}
$web.Dispose()
}
—————————————————————————————————————————————————–
For SharePoint 2010 just replace the first three lines of both of these scripts with this line.
$webs = get-spsite http://portal/sites | get-spweb
