IRM enabling using PowerShell on SP online list

Here’s my script to set IRM settings in SharePoint online library.

$site = “****”
$Context = Get-ClientContext $Username $password $site
$list = $Context.Web.Lists
Foreach($lists in $list)
if($lists.BaseType -eq “DocumentLibrary” -and $lists.Hidden -eq $false)
write-host $lists
set-SPOList -ListName $lists
$lists.IrmEnabled =$true
$lists.InformationRightsManagementSettings.PolicyTitle = “RMSDefaultPolicy”
$lists.InformationRightsManagementSettings.PolicyDescription = “Default RMS Policy”
$lists.IrmReject = $true
write-host “hi i am executing”
$lists.InformationRightsManagementSettings.AllowPrint = $true
$lists.InformationRightsManagementSettings.EnableLicenseCacheExpire = $true
$lists.InformationRightsManagementSettings.LicenseCacheExpireDays = “8”
write-Host $lists.Title + “hi”




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s