O365 Unified Labelling - Policy Creation
# Define credentials | |
$AdminCredentials = Get-Credential "myadmin@oholics.net" | |
# Create the session | |
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/ -Credential $AdminCredentials -Authentication Basic -AllowRedirection | |
# Import the session | |
Import-PSSession $Session -DisableNameChecking | |
# Define the tenant | |
$MyTenant = "CN=Configuration,CN=<TenantID>.onmicrosoft.com,OU=Microsoft Exchange Hosted Organizations,DC=FFO,DC=extest,DC=microsoft,DC=com" | |
# Get the labels to add to the policy | |
$Label1=Get-Label -Identity "CN=My Label,$MyTenant" | |
$Label2=Get-Label -Identity "CN=My Sub Label,$MyTenant" | |
# Create the Label Policy | |
New-LabelPolicy -Name "My Label Policy" -Labels $Label1.name,$Label2.Name -ExchangeLocation "All" | |
# Set the advanced settings on the new policy | |
Set-LabelPolicy -Identity "My Label Policy" -AdvancedSettings @{EnableCustomPermissions="False"} | |
Set-LabelPolicy -Identity "My Label Policy" -AdvancedSettings @{AttachmentAction="Automatic"} | |
Set-LabelPolicy -Identity "My Label Policy" -AdvancedSettings @{HideBarByDefault="False"} | |
Set-LabelPolicy -Identity "My Label Policy" -AdvancedSettings @{RequireDowngradeJustification="True"} | |
# When you are totally finished, disconnect the session | |
Remove-PSSession $Session |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment