1.For In Place Records Management feature, please run below PowerShell.
#Variables for Processing
$SiteURL = "https:/tenant.sharepoint.com/sites/emilytestnew"
$FeatureGUID =[System.GUID]("da2e115b-07e4-49d9-bb2c-35e93bb9fca9")
$LoginName ="******@tenant.onmicrosoft.com"
$LoginPassword ="LoginPassword"
#Get the Client Context
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
#Login Credentials
$SecurePWD = ConvertTo-SecureString $LoginPassword -asplaintext -force
$Credential = new-object -typename System.Management.Automation.PSCredential -argumentlist $LoginName, $SecurePWD
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Credential.UserName,$Credential.Password)
#Get the Site
$site = $ctx.site
#sharepoint online powershell activate feature
$site.Features.Add($FeatureGUID, $force, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::farm)
$ctx.ExecuteQuery()
write-host "Feature has been Activated!"
2.For Library and Folder Based Retention feature, please run below PowerShell.
#Variables for Processing
$SiteURL = "https://tenant.sharepoint.com/sites/emilytestnew"
$FeatureGUID =[System.GUID]("063c26fa-3ccc-4180-8a84-b6f98e991df3")
$LoginName ="******@tenant.onmicrosoft.com"
$LoginPassword ="LoginPassword"
#Get the Client Context
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
#Login Credentials
$SecurePWD = ConvertTo-SecureString $LoginPassword -asplaintext -force
$Credential = new-object -typename System.Management.Automation.PSCredential -argumentlist $LoginName, $SecurePWD
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Credential.UserName,$Credential.Password)
#Get the Site
$site = $ctx.site
#sharepoint online powershell activate feature
$site.Features.Add($FeatureGUID, $force, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::farm)
$ctx.ExecuteQuery()
write-host "Feature has been Activated!"
3.Result:
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.