The PowerShell Script given below will create a subsite with the blank template and multiple document libraries, using custom template.

In my case, custom template name is Farm Template.

Add-PSSnapin "Microsoft.SharePoint.Powershell".

  1. #create a subsite using blank Template
  2. $WebAppUrl="https://SharePoint.com/Sites/TEST"
  3. #->SubSite1<-
  4. $SubSiteTitle1 = "Subsite"
  5. $SubSite1Url = "Subsite"
  6. New-SPWeb –url $WebAppUrl"/"$SubSite1Url -name $SubSiteTitle1 -Template "STS#1" –AddToTopNav –UseParentTopNav
  7. #load the custom template to new subsite
  8. $site = Get-SPSite https://SharePoint.com/Sites/TEST
  9. $web = Get-SpWeb https://SharePoint.com/Sites/TEST/Subsite
  10. $custTemplate = $site.GetCustomListTemplates($web)
  11. #Verify the custom template name
  12. $custTemplate | select name
  13. write-host "Loading powershell module" -ForegroundColor Red
  14. # specify the source and destination sites
  15. $sourceWeb = "https://SharePoint.com/Sites/TEST";
  16. $DestinationWeb = "https://SharePoint.com/Sites/TEST/Subsite";
  17. # get the source and destination sites web objects
  18. $sourceWebObj = Get-SPWeb $sourceWeb;
  19. $DestinationWebObj = Get-SPWeb $DestinationWeb;
  20. #creating new document libraries using custom template.
  21. $listTemplate = [Microsoft.SharePoint.SPListTemplateType]::"FarmTemplate"
  22. $DestinationWebObj.Lists.Add("01","My Doc Library",$custTemplate["FarmTemplate"]);
  23. $DestinationWebObj.Lists.Add("02","My Doc Library",$custTemplate["FarmTemplate"]);
  24. $DestinationWebObj.Lists.Add("03","My Doc Library",$custTemplate["FarmTemplate"]);
  25. $DestinationWebObj.Lists.Add("04","My Doc Library",$custTemplate["FarmTemplate"]);
  26. $DestinationWebObj.Lists.Add("05","My Doc Library",$custTemplate["FarmTemplate"]);

You can add as many document libraries as you want.

I hope this helps.

If you like it please leave a comment.