How to Add new content type to SharePoint Document Library using Powershell
$site = Get-SPSite SiteURL foreach($web in $site.AllWebs){ $listCounter = $web.Lists.Count for($i=0;$i -le $listCounter;$i++) { $list = $web.Lists[$i] if($list.BaseType -eq "DocumentLibrary") { $newList = $web.Lists.item($list.ID); $newList.ContentTypesEnabled = $true $newList.Update() #Add site content types to the list $ctToAdd = $site.RootWeb.ContentTypes["New Excel"] $ct = $newList.ContentTypes.Add($ctToAdd) write-host "Content type" $ct.Name "added to list" $newList.Title $ctToAdd = $site.RootWeb.ContentTypes["New PowerPoint"] $ct = $newList.ContentTypes.Add($ctToAdd) write-host "Content type" $ct.Name "added to list" $newList.Title ...