I'm using the code below to create document libraries, but I need to set the "Document template" value to "Web part page". I can list the document templates using $spWeb.DocTemplates - but how can I set the value using PowerShell?

$spWeb = Get-SPWeb -Identity <url>
$listTemplate = [Microsoft.SharePoint.SPListTemplateType]::DocumentLibrary
$spWeb.Lists.Add("Listname","List description", $listTemplate)

1 Answer 1


Check out my answer here: Set the Document Template of a Document Library programmatically

I think you can easily convert code provided there to PowerShell (if not let me know). Also be sure to read additional info.

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.