SharePoint 2010 + PowerShell: View Dependencies of Content Types (aka Content Type Usage)
Earlier today, I created some test Content Types while playing around with the fancy new Content Organizer. I ran into a few errors, though, and subsequently wanted to delete the dummy content types to start over. I was unable to, however, because the content types were still in use. By what? I didn't know.
Too bad SharePoint doesn't have a feature similar to SQL Server Management Studio's "View Dependencies." Till it does.. here is a PowerShell script that does the trick.
1$sitename = "https://sharepoint"
2$contentType = "My Custom Content Type"
3
4$web = Get-SPWeb $sitename
5$ct = $web.AvailableContentTypes[$contentType]
6$ctusage = [Microsoft.SharePoint.SPContentTypeUsage]::GetUsages($ct)
7foreach ($ctuse in $ctusage) { $ctuse.Url }
8
9$web.Dispose()
Looking for content type usage within subsites? A more thorough script can be found at StackExchange.