Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. function enableCatalog($arrayOfLists)
  2. {
  3. foreach($list in $arrayOfLists)
  4. {
  5. write-host "Enabling catalog on list " $list -foregroundcolor Yellow
  6. $list.IndexedRootFolderPropertyKeys.Add("PublishingCatalogSettings")
  7. $list.IndexedRootFolderPropertyKeys.Add("IsPublishingCatalog")
  8.  
  9. #Break permission inheritance
  10. $list.BreakRoleInheritance($true,$true)
  11.  
  12. #Enable anonymous to the catalog
  13. $list.AnonymousPermMask = 8192 # 0 to disable anonymous
  14.  
  15. $rootFolder = $list.RootFolder
  16. $rootFolder.Properties.Add("IsPublishingCatalog", "True") #Activate catalog
  17.  
  18. $rootFolder.Update()
  19. $list.Update()
  20. write-host "Catalog successfully enabled on " $list -foregroundcolor Green
  21. }
  22. }
  23.  
  24. $lists = <an array of list objects>
  25.  
  26. enableCatalog $lists
  27.  
  28. $web.Dispose()
  29. $site.Dispose()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement