2

Is it possible to list the Default Content type per Library via PowerShell?

1
  • do you want to get default content type in all lists in a give site?
    – Waqas Sarwar MVP
    Commented May 5, 2015 at 20:37

1 Answer 1

1

You can get the list of content types associated with a List. And the first one is the default one.

$webs = Get-SPSite http://siteurl | Get-SPWeb 

foreach ($web in $webs) 
{
    foreach ($list in $web.lists) 
    { 
        if($list.ContentTypes.Count > 0)
        {
            Write-Host "Default Content Type = " + $list.ContentTypes[0].Name
        }
    } 
    $web.Dispose() 
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.