Advertisement
Guest User

Untitled

a guest
Dec 14th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. $siteCollectionUrl="http://sp2013/sites/team"
  2. $templateNamesToRemove = "COMMUNITY#0","COMMUNITYPORTAL#0"
  3.  
  4. Start-SPAssignment -Global
  5. $web = Get-SPWeb $siteCollectionUrl
  6.  
  7. # get the existing web templates from the site that will be filtered down
  8. # 1033 is the locale id for English US (en-us), be sure to change to your locale
  9. $existingWebTemplates = $web.GetAvailableWebTemplates(1033)
  10. $newWebTemplates = New-Object "System.Collections.ObjectModel.Collection[Microsoft.SharePoint.SPWebTemplate]"
  11.  
  12. # filter existing web templates and only keep if in the list of template names to keep
  13. $newWebTemplates = $existingWebTemplates | Where-Object {$_.name -notin $templateNamesToRemove}
  14. $web.SetAvailableWebTemplates($newWebTemplates, 1033)
  15. $web.Update()
  16.  
  17. Stop-SPAssignment -Global
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement