Advertisement
Guest User

Untitled

a guest
Sep 30th, 2017
511
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.65 KB | None | 0 0
  1. Feature Description Feature Scope Feature ID Problem
  2. PSWApproval Feature Site collection ad739f9e-1525-4dec-a25e-10821ca70c95 Not activated
  3. GlobalHold Feature Site collection 2a6bf8e8-10b5-42f2-9d3e-267dfb0de8d4 Not activated
  4. PWAWebParts Feature Site collection 10eb8dad-31aa-4461-9843-27305d0c7c93 Not activated
  5. PwaIdeaList Feature Site collection ce0143de-6894-428b-9f6b-37bd6848ec26 Not activated
  6. PWARibbon Feature Site collection 1d253548-c70d-40fd-9930-9d313bedc359 Not activated
  7. MobileExcelWebAccess Feature Site collection e995e28b-9ba8-4668-9933-cf5c146d7a9f Not activated
  8. This template can't be used for this site collection until the issues above are resolved.
  9.  
  10. #Required Parameters
  11. $sSiteColUrl = "https://portal.sharepoint.com"
  12. $sUserName = "admin@portal.com"
  13. $sFeatureGuid="2a6bf8e8-10b5-42f2-9d3e-267dfb0de8d4"
  14. $sPassword = Read-Host -Prompt "Enter your password: " -AsSecureString
  15.  
  16. #Script that enables a feature in a SPO Site
  17. # Required Parameters:
  18. # -> $sUserName: User Name to connect to the SharePoint Online Site Collection.
  19. # -> $sPassword: Password for the user.
  20. # -> $sSiteColUrl: SharePoint Online Site Collection
  21. # -> $sFeatureGuid: GUID of the feature to be enabled
  22.  
  23.  
  24. $host.Runspace.ThreadOptions = "ReuseThread"
  25.  
  26. #Definition of the function that allows to enable a SPO Feature
  27. function Enable-SPOFeature
  28. {
  29. param ($sSiteColUrl,$sUserName,$sPassword,$sFeatureGuid)
  30. try
  31. {
  32. #Adding the Client OM Assemblies
  33. Add-Type -Path "C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions15ISAPIMicrosoft.SharePoint.Client.dll"
  34. Add-Type -Path "C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions15ISAPIMicrosoft.SharePoint.Client.Runtime.dll"
  35.  
  36. #SPO Client Object Model Context
  37. $spoCtx = New-Object Microsoft.SharePoint.Client.ClientContext($sSiteColUrl)
  38. $spoCredentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($sUsername, $sPassword)
  39. $spoCtx.Credentials = $spoCredentials
  40.  
  41. Write-Host "----------------------------------------------------------------------------" -foregroundcolor Green
  42. Write-Host "Enabling the Feature with GUID $sFeatureGuid !!" -ForegroundColor Green
  43. Write-Host "----------------------------------------------------------------------------" -foregroundcolor Green
  44.  
  45. $guiFeatureGuid = [System.Guid] $sFeatureGuid
  46. #############################################
  47. # todo: change object: $spoSite=$spoCtx.Site | $spoSite=$spoCtx.Web
  48. $spoSite=$spoCtx.Site
  49.  
  50. # todo: change scope: [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None | Farm | Site | Web
  51. # https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.featuredefinitionscope.aspx?f=255&MSPPError=-2147217396
  52. $spoSite.Features.Add($sFeatureGuid, $true, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None)
  53. #############################################
  54.  
  55. $spoCtx.ExecuteQuery()
  56. $spoCtx.Dispose()
  57. }
  58. catch [System.Exception]
  59. {
  60. write-host -f red $_.Exception.ToString()
  61. }
  62. }
  63.  
  64. #Required Parameters
  65. $sSiteColUrl = "https://portal.sharepoint.com"
  66. $sUserName = "admin@portal.com"
  67. $sFeatureGuid= " e995e28b-9ba8-4668-9933-cf5c146d7a9f"
  68. $sPassword = Read-Host -Prompt "Enter your password: " -AsSecureString
  69.  
  70. Enable-SPOFeature -sSiteColUrl $sSiteColUrl -sUserName $sUserName -sPassword $sPassword -sFeatureGuid $sFeatureGuid
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement