I have a scheduled job which runs daily and applies a Mailbox Retention Policy to any new mailboxes created.
The schedule jobs runs this script. I am trying to exclude a mailbox from this policy. Help please.
function Load_Exchange_Tools {
if (-not (Get-pssnapin | ? {$_.name -like 'Microsoft.Exchange.Management.PowerShell.e2010'})) {
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.e2010
}
}
Load_Exchange_Tools
Get-Mailbox -Filter {CustomAttribute1 -ne "LITHOLD"} -ResultSize Unlimited | Set-Mailbox -RetentionPolicy "Company Mailbox Policy"