Home > Appendices > Appendix R – How to Get All Features using PowerShell

Export to PDF

Appendix R – How to Get All Features using PowerShell

You can use PowerShell to get site and site collection features in SharePoint Online. Refer to the following instructions.

Get site features in SharePoint Online

To access the site features, you must first install the SharePoint Online Client Components SDK. You can download the latest version from the official Microsoft Download Center: SharePoint Online Client Components SDK.

Use the following commands to retrieve site features in SharePoint Online:

|#Load SharePoint CSOM AssembliesAdd-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" #Variables$SiteURL="https://.sharepoint.com" #Setup Credentials to connect$Cred= Get-Credential$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password) #Setup the context$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)$Ctx.Credentials = $Credentials #Get Web Level FeaturesWrite-host "`nWeb Scoped Features:"#Get web Features$WebFeatures = $Ctx.Web.Features$Ctx.Load($WebFeatures)$Ctx.ExecuteQuery() #Loop through each feature and get feature dataForEach($Feature in $WebFeatures){ $Feature.Retrieve("DisplayName") $Ctx.Load($Feature) $Ctx.ExecuteQuery() $Feature | Select DisplayName, DefinitionId}| |-|

Get site collection features in SharePoint Online

Use the following commands to retrieve site collection features in SharePoint Online:

|#Import SharePoint Online Management ShellImport-Module Microsoft.Online.Sharepoint.PowerShell -DisableNameChecking #Variables$SiteURL="https://.sharepoint.com" #Setup Credentials to connect$Cred= Get-Credential$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password) #Setup the context$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)$Ctx.Credentials = $Credentials #Get Site Collection Features$SiteCollFeatures = $Ctx.Site.Features$Ctx.Load($SiteCollFeatures)$Ctx.ExecuteQuery() #Loop through each feature and get feature dataWrite-host "`nSite Collection Features:"ForEach($Feature in $SiteCollFeatures){ $Feature.Retrieve("DisplayName") $Ctx.Load($Feature) $Ctx.ExecuteQuery() $Feature | Select DisplayName, DefinitionId}| |-|