Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $siteCollectionUrl="http://sp2013/sites/team"
- $templateNamesToRemove = "COMMUNITY#0","COMMUNITYPORTAL#0"
- Start-SPAssignment -Global
- $web = Get-SPWeb $siteCollectionUrl
- # get the existing web templates from the site that will be filtered down
- # 1033 is the locale id for English US (en-us), be sure to change to your locale
- $existingWebTemplates = $web.GetAvailableWebTemplates(1033)
- $newWebTemplates = New-Object "System.Collections.ObjectModel.Collection[Microsoft.SharePoint.SPWebTemplate]"
- # filter existing web templates and only keep if in the list of template names to keep
- $newWebTemplates = $existingWebTemplates | Where-Object {$_.name -notin $templateNamesToRemove}
- $web.SetAvailableWebTemplates($newWebTemplates, 1033)
- $web.Update()
- Stop-SPAssignment -Global
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement