Powershell to Manager ManagedFolderpolicy on user accounts

Powershell to manage Managedfolderpolicy on user accounts

Below powershell to apply -Managedfolderpolicy new user mailbox at the time of new mailbox creation

New-Mailbox -Name $DName -Database $Database -UserPrincipalName $PrincipalName -FirstName $FName -LastName $LName -Alias $Aliasname -Password $passwd -ResetPasswordOnNextLogon $true -SamAccountName $Aliasname -ManagedFolderMailboxPolicy $MPolicy

Below  powershell to apply folderpolicy to set to all the mailbox in the orginization

$Folderpolicy = “Policyname”
get-mailbox -ResultSize unlimited |Set-Mailbox -Identity -ManagedFolderMailboxPolicy $Folderpolicy

Powershell to remove folderpolicy to specific users in the DL

Get-DistributionGroupMember $group | Set-Mailbox -Identity -ManagedFolderMailboxPolicy $null